Skip to content

Commit f11250c

Browse files
2 parents dcf33e3 + f62c218 commit f11250c

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
@@ -921,11 +921,11 @@ export class DynamicForm extends React.Component<
921921
try {
922922

923923
// Fetch form rendering information from SharePoint
924-
const listInfo = await this._spService.getListFormRenderInfo(listId);
924+
const listInfo = await this._spService.getListFormRenderInfo(listId, this.webURL);
925925

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

931931
// Build a dictionary of validation formulas and messages
@@ -1178,7 +1178,8 @@ export class DynamicForm extends React.Component<
11781178
const response = await this._spService.getSingleManagedMetadataLabel(
11791179
listId,
11801180
listItemId,
1181-
field.InternalName
1181+
field.InternalName,
1182+
this.webURL
11821183
);
11831184
if (response) {
11841185
selectedTags.push({
@@ -1243,7 +1244,7 @@ export class DynamicForm extends React.Component<
12431244
}
12441245

12451246
dateFormat = field.DateFormat || "DateOnly";
1246-
defaultDayOfWeek = (await this._spService.getRegionalWebSettings()).FirstDayOfWeek;
1247+
defaultDayOfWeek = (await this._spService.getRegionalWebSettings(this.webURL)).FirstDayOfWeek;
12471248
}
12481249

12491250
// Setup Thumbnail, Location and Boolean fields
@@ -1333,7 +1334,8 @@ export class DynamicForm extends React.Component<
13331334
listItemId,
13341335
file.fileName,
13351336
buffer,
1336-
undefined
1337+
undefined,
1338+
this.webURL
13371339
);
13381340
}
13391341
};

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)