Skip to content

Commit 634560e

Browse files
committed
Bugfix for issue #1758
Added missing references to webURL to service calls.
1 parent dd5e8fc commit 634560e

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/controls/dynamicForm/DynamicForm.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -915,11 +915,11 @@ export class DynamicForm extends React.Component<
915915
try {
916916

917917
// Fetch form rendering information from SharePoint
918-
const listInfo = await this._spService.getListFormRenderInfo(listId);
918+
const listInfo = await this._spService.getListFormRenderInfo(listId, this.webURL);
919919

920920
// Fetch additional information about fields from SharePoint
921921
// (Number fields for min and max values, and fields with validation)
922-
const additionalInfo = await this._spService.getAdditionalListFormFieldInfo(listId);
922+
const additionalInfo = await this._spService.getAdditionalListFormFieldInfo(listId, this.webURL);
923923
const numberFields = additionalInfo.filter((f) => f.TypeAsString === "Number" || f.TypeAsString === "Currency");
924924

925925
// Build a dictionary of validation formulas and messages
@@ -1166,7 +1166,8 @@ export class DynamicForm extends React.Component<
11661166
const response = await this._spService.getSingleManagedMetadataLabel(
11671167
listId,
11681168
listItemId,
1169-
field.InternalName
1169+
field.InternalName,
1170+
this.webURL
11701171
);
11711172
if (response) {
11721173
selectedTags.push({
@@ -1229,7 +1230,7 @@ export class DynamicForm extends React.Component<
12291230
}
12301231

12311232
dateFormat = field.DateFormat || "DateOnly";
1232-
defaultDayOfWeek = (await this._spService.getRegionalWebSettings()).FirstDayOfWeek;
1233+
defaultDayOfWeek = (await this._spService.getRegionalWebSettings(this.webURL)).FirstDayOfWeek;
12331234
}
12341235

12351236
// Setup Thumbnail, Location and Boolean fields
@@ -1318,7 +1319,8 @@ export class DynamicForm extends React.Component<
13181319
listItemId,
13191320
file.fileName,
13201321
buffer,
1321-
undefined
1322+
undefined,
1323+
this.webURL
13221324
);
13231325
}
13241326
};

src/services/SPService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,9 +654,9 @@ export default class SPService implements ISPService {
654654
}
655655
}
656656

657-
public async getSingleManagedMetadataLabel(listId: string, listItemId: number, fieldName: string): Promise<any> { // eslint-disable-line @typescript-eslint/no-explicit-any
657+
public async getSingleManagedMetadataLabel(listId: string, listItemId: number, fieldName: string, webUrl?: string): Promise<any> { // eslint-disable-line @typescript-eslint/no-explicit-any
658658
try {
659-
const webAbsoluteUrl = this._context.pageContext.web.absoluteUrl;
659+
const webAbsoluteUrl = !webUrl ? this._context.pageContext.web.absoluteUrl : webUrl;
660660
const apiUrl = `${webAbsoluteUrl}/_api/web/lists(@listId)/RenderListDataAsStream?@listId=guid'${encodeURIComponent(listId)}'`;
661661
const data = await this._context.spHttpClient.post(apiUrl, SPHttpClient.configurations.v1, {
662662
body: JSON.stringify({

0 commit comments

Comments
 (0)