diff --git a/src/controls/dynamicForm/DynamicForm.tsx b/src/controls/dynamicForm/DynamicForm.tsx index eb15b71e5..040185b36 100644 --- a/src/controls/dynamicForm/DynamicForm.tsx +++ b/src/controls/dynamicForm/DynamicForm.tsx @@ -915,11 +915,11 @@ export class DynamicForm extends React.Component< try { // Fetch form rendering information from SharePoint - const listInfo = await this._spService.getListFormRenderInfo(listId); + const listInfo = await this._spService.getListFormRenderInfo(listId, this.webURL); // Fetch additional information about fields from SharePoint // (Number fields for min and max values, and fields with validation) - const additionalInfo = await this._spService.getAdditionalListFormFieldInfo(listId); + const additionalInfo = await this._spService.getAdditionalListFormFieldInfo(listId, this.webURL); const numberFields = additionalInfo.filter((f) => f.TypeAsString === "Number" || f.TypeAsString === "Currency"); // Build a dictionary of validation formulas and messages @@ -1166,7 +1166,8 @@ export class DynamicForm extends React.Component< const response = await this._spService.getSingleManagedMetadataLabel( listId, listItemId, - field.InternalName + field.InternalName, + this.webURL ); if (response) { selectedTags.push({ @@ -1229,7 +1230,7 @@ export class DynamicForm extends React.Component< } dateFormat = field.DateFormat || "DateOnly"; - defaultDayOfWeek = (await this._spService.getRegionalWebSettings()).FirstDayOfWeek; + defaultDayOfWeek = (await this._spService.getRegionalWebSettings(this.webURL)).FirstDayOfWeek; } // Setup Thumbnail, Location and Boolean fields @@ -1318,7 +1319,8 @@ export class DynamicForm extends React.Component< listItemId, file.fileName, buffer, - undefined + undefined, + this.webURL ); } }; diff --git a/src/services/SPService.ts b/src/services/SPService.ts index 7a276ab73..3edcf6f56 100644 --- a/src/services/SPService.ts +++ b/src/services/SPService.ts @@ -654,9 +654,9 @@ export default class SPService implements ISPService { } } - public async getSingleManagedMetadataLabel(listId: string, listItemId: number, fieldName: string): Promise { // eslint-disable-line @typescript-eslint/no-explicit-any + public async getSingleManagedMetadataLabel(listId: string, listItemId: number, fieldName: string, webUrl?: string): Promise { // eslint-disable-line @typescript-eslint/no-explicit-any try { - const webAbsoluteUrl = this._context.pageContext.web.absoluteUrl; + const webAbsoluteUrl = !webUrl ? this._context.pageContext.web.absoluteUrl : webUrl; const apiUrl = `${webAbsoluteUrl}/_api/web/lists(@listId)/RenderListDataAsStream?@listId=guid'${encodeURIComponent(listId)}'`; const data = await this._context.spHttpClient.post(apiUrl, SPHttpClient.configurations.v1, { body: JSON.stringify({