SPFx React
14 TopicsSPFx webparts not able to acquire token for Graph API in Teams app (Viva Connections)
Hi all, There is a very strange thing happening to a few webparts that we've build for one of our clients. We haven't seen this problem in other tenants, it seems to be related to this specific tenant. Maybe it's a setting, or maybe it's a bug. Hopefully someone can help us. This is the case: We have created a SharePoint intranet site and made it the root site. We then added the site to the Viva Connections integration in Teams, as an app. On this site we have a couple of custom webparts that we created. One of the webparts have been used in many intranet sites and haven't had these problems so far. The problem also isn't occurring on SharePoint itself. The problem is connecting to the Graph API, the token doesn't seem to be retrieved and thus the API requests are not even send to the Graph API. Environment details: Microsoft Egde version 115.0.1901.183 (Official build) (64-bit) SPFx 1.17.4 Node 16.15.1 NPM 8.11.0 The error I'm getting: Uncaught (in promise) Error: Token request previously failed at new t (chunk.aadTokenProvider_en-us_445a72773ba77a61be93.js:1:1514) at e._getTokenInternal (chunk.aadTokenProvider_en-us_445a72773ba77a61be93.js:1:3567) at e.getToken (chunk.aadTokenProvider_en-us_445a72773ba77a61be93.js:1:2372) at sp-pages-assembly_en-us_c3c628b67d521769ee27f473c0ed9543.js:76:647657 The request that might be the problem: https://tenant.sharepoint.com/_api/Microsoft.SharePoint.Internal.ClientSideComponent.Token.AcquireOBOToken?resource=%27https://graph.microsoft.com%27&clientId=%2775aff87b-45bf-41e7-84f3-552901a72ea0%27 Results in an 500 internal server error with the following message: { "odata.error": { "code": "-1, System.AggregateException", "message": { "lang": "en-US", "value": "One or more errors occurred." } } } I found this issue https://github.com/SharePoint/sp-dev-docs/issues/7884 which seems to be related to mine or at least gives the same error, but the resolution there doesn't apply here sadly. The manifest is already in the right format and with the correct data. Also cross referenced the manifest with other, working tenants At this point I have no clue on what the cause of the issue is, could any of you help me with this problem? Kind regards, ArjenSolved4.7KViews0likes4CommentsHow to get Sharepoint online folder default properties using pnpjs library
Hello, Please I am trying to get the default folder properties from sharepoint document library. Attached are some of the properties that i could get but there are other properties I would like to retrieve, i.e. The image thumbnail, FileRef, FSObjType, FileLeafRef, ServerRelativeUrl, Folder.. etc. Below is my code:2.6KViews0likes1CommentHow to get file versions and comments
Hi All, I am SharePoint online site, SPFX and React. I am trying below code to get versions and comments but in comments I am getting same comment to all version which is latest. Not getting why we gets same comments to all versions. Is there any other way to get this. web.lists.getByTitle("Documents").items.getById(Itemid).versions.get().then(v => { console.log("admin"); Logger.Log("getByTitle: " + v); Logger.Log("Inside v: " + v); Object.keys(v).forEach((key) => { console.log(v[key]); //Logger.Log("v[key]: " + v[key]); Logger.Log("OData__x005f_CheckinComment: " + v[key].OData__x005f_CheckinComment); Logger.Log("OData__x005f_UIVersionString: " +v[key].OData__x005f_UIVersionString); }); }) .catch((e) => { console.log("adminerror" + e); return false; }); How to get versions and comments of file? Thanks, Harish Patil2.3KViews0likes1CommentSharePoint List Item Person field only returns FieldId and FieldStringId
I have a list with a few columns that are Person columns. Below is a snippet without a select nor expand: const newHires = this._sp.web.lists.getById(${listId}).items<ListItem[]>(); const resolvedTasks = Promise.resolve(newHires); Two of my Person fields are called Manager and Dude. As you'll see from the screenshot, I only get DudeId and DudeStringId (ditto for Manager field). When I try the following: const newHires = this._sp.web.lists.getById(`${listId}`).items.select("Manager/Email").expand("Manager")<ListItem[]>(); I get the following 400 error: "odata.error":{"code":"-1, Microsoft.SharePoint.SPException","message":{"lang":"en-US","value":"The query to field 'Manager' is not valid. The $select query string must specify the target fields and the $expand query string must contains Manager." I've also checked in the library settings that the field name is indeed Manager.1.6KViews0likes1CommentHow to create custom section layout options for SharePoint online modern site pages?
Hello Everyone, SharePoint provides default layout options below as mentioned in the screenshot. How can we create custom section layout options as per our needs? If there are any ways to create custom section layout options then please let me know your thoughts on the same. Can anyone help me with the same? Thanks1.6KViews0likes1CommentWebpart not rendering filePicked utliizing PnP FilePicker
Hello, I am using SPfx PnP FilePicker property control. When I check the Edge developer tools, I can see the image being saved to SPO, but the image does not render within the webpart. Is there anyway someone can see if I am implementing something wrongly? Thank you! public render(): React.ReactElement<ICallingCardsProps> { const thumbRend = "https://media.akamai.odsp.cdn.office.net/uksouth1-mediap.svc.ms/transform/thumbnail?provider=url&inputFormat=jpg&docid="; let arr = this.props.CallingCards || []; if (this.props.CallingCards && this.props.CallingCards.length > 0) { var contacts = arr.map(el => <div className={`${styles.tile}`}> <div className={`${styles.galleryframe}`}> <img className={`${styles.galleryimg}`} key={el} src={el.filePicker.fileNameWithoutExtension == '' ? el.filePicker.fileAbsoluteUrl : ''} /> <div key={el}>{el.Name}</div> <div key={el}>{el.Email}</div> <div key={el}>{el.PhoneNumber}</div> </div> </div> ) } else { return ( <div className={`${styles.welcome}`}>Use property pane to create new Contact Cards!</div> ) } return ( <body style={{ height: '225px' }}> <div className={`${styles.grid}`}> {contacts} </div> </body> ); } private async uploadFiles(fileContent, fileName, FolderPath) { try { if (fileContent.size <= 10485760) { // small upload let result = await this.sp.web.getFolderByServerRelativePath(FolderPath).files.addUsingPath(FolderPath, fileContent.type, { Overwrite: true }); console.log(result); } else { // large upload let result = await this.sp.web.getFolderByServerRelativePath(FolderPath).files.addChunked(FolderPath, fileContent.type, data => { console.log(`progress`); }, true); } } catch (err) { // (error handling removed for simplicity) return Promise.resolve(false); } } { id: "filePicker", title: "Select File", type: CustomCollectionFieldType.custom, onCustomRender: (field, value, onUpdate, item, itemId, onError) => { return ( React.createElement(FilePicker, { key: itemId, context: this.context, buttonLabel: "Select File", onChange: async (filesPicked: IFilePickerResult[]) => { for (const filePicked of filesPicked) { const filePickedContent = await filePicked.downloadFileContent(); const folderPath = await filePicked.fileAbsoluteUrl this.uploadFiles(filePickedContent, filePicked.fileName, folderPath); console.log('onChange....', filesPicked) } }, onSave: async (filesPicked: IFilePickerResult[]) => { for (const filePicked of filesPicked) { const filePickedContent = await filePicked.downloadFileContent(); const folderPath = await filePicked.fileAbsoluteUrl this.uploadFiles(filePickedContent, filePicked.fileName, folderPath); } console.log('onSave....', filesPicked) } }) ); }, required: true },1.3KViews0likes1CommentHow do you Navigate between pages in SPFx(React) Teams solution .
We can use React links to navigate between pages in a normal website, but in React spfx solution there is no links that we can use, so how would you navigate between , pages in React spfx solution. Something I came up with was, conditional rendering of all the components and putting them all in a single file, and passing callback function as props. but in this case I have to forecefully execute UseEffect when, a page is rendered , or the master page is rendered. Instead of this is there anything that can be done. for navigating between pages in React using SPFx solution for TEAMS.956Views0likes0CommentsSPFx - ListView Extension - Get WebPartContext
Hi All, I'm currently working on a SPFx List View Command Set extension using React. This is OnPrem (SP 2019) so using SPFx 1.4.1. Have created a Service class for my common queries to SharePoint. In one of the call I want to pass WebPartContext from ListViewCommandSet.ts file. When accessed from this.context I'm getting List scope which is fine but now how can I access WebPartContext either in ListViewCommandSet.ts file so I can pass it to Service or access it in Service TS file? Any help would be appreciated. Thanks, Sanjay953Views0likes0Commentssearching an External user in People picker and starting an invitation
I want to write code to search for non-existing external user email for next step giving me this email as suggestion for sending them an invitation. for example, there is a functionality by Standard SharePoint (the picture below) when you want to share the SharePoint site with some non- existing external user (OOB UI)812Views0likes1Comment