Forum Widgets
Latest Discussions
How to Get the Correct Client ID for Graph API Authentication in SPFx Without Forcing Login?
Hello everyone, I'm trying to connect my SPFx web part to the Microsoft Graph API in the most modern and seamless way possible, avoiding any additional login prompts for the user. Here's the setup I'm currently using: _graph = graphfi().using(graphSPFx(context as ISPFXContext)); It's crucial for me to retrieve all the Graph API credentials directly from the SharePoint context to ensure a seamless experience for users. However, I'm encountering a 400 error when trying to acquire the token: AADSTS500011: The resource principal named 806f609a-6160-4235-ab06-91c8fe86ccee was not found in the tenant named ***. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant... The issue here is that the clientId mentioned (806f609a-6160-4235-ab06-91c8fe86ccee) does not exist in our tenant's Azure AD, and it never has. From my research, this seems like some kind of fallback client ID from Microsoft. The only way I can get it to work is by explicitly adding the correct clientId manually like this: _graph = graphfi().using(graphSPFx(context as ISPFXContext)).using(MSAL({ authParams: { scopes: [...] }, configuration: { auth: { clientId: "CORRECT_CLIENT_ID", // copied from AD authority: "https://login.microsoftonline.com/{tenantId}" }, cache: {...} } })); However, this approach causes a redirect or popup prompt, often requiring users to use multi-factor authentication on their mobile devices. My goal is to avoid this entirely. Questions: How can I retrieve the correct clientId directly from the SharePoint context? The context itself doesn't seem to expose what client ID is being used to authenticate to the Graph API. Is there any way to handle this without modifying the context or forcing a re-login? Why does SharePoint seem to be using this "mysterious" fallback client ID that doesn't exist in the tenant? I've looked at multiple tutorials, but most of them are outdated by several years (some over 8 years old). Even following those tutorials results in the same error when testing in the Workbench or after deployment. Does anyone know a way to address this issue without combing through outdated documentation? I’d appreciate any guidance or insights! Thank you in advance! Best regards, MarioShuiTaCodeJan 23, 2025Copper Contributor20Views0likes0CommentsUnable to edit Sharepoint list item - Invalid date-time value
Hi. I've run into a weird problem with one of my Sharepoint lists. When trying to edit any field in said list, I get the following error: Invalid date-time value. The only "Date and time" columns in my list are the default Created and Modified columns. When I added these fields to the list view the dates are in the following format: 2022-10-27T09.09.14Z I have added a new item to the list on 27.10.2022 and had no problems adding that, so this issue is pretty new. Other lists can be edited on the site just fine, and their Created/Modified Columns are displayed in a different format (Yesterday, May 9 etc..). Any clues as to what could be causing this issue or how to fix it would be appreciated. I would've included pictures, but am unable to post them (probably because I've just signed up). Thanks in advance, aapokaapokJan 21, 2025Copper Contributor10KViews0likes21CommentsPrevent Automatically Opening the File Explorer on the Upload Tab (filepicker)
I am working on an application customizer that will inject custom UI into the File Picker's Upload tab. Because of this, I want to prevent the file explorer from automatically opening when the user clicks on the Upload tab. I’ve tried several methods to achieve this by manipulating the DOM through my custom code in the application customizer. I even tried removing the "file" input element from my custom code. However, the file explorer still opens automatically when the user clicks on the Upload tab. Is there any way to prevent this?addindeveloper1Jan 21, 2025Copper Contributor4Views0likes0CommentsMicrosoft Graph Search API Not Searching Image Titles
Dear, I am using the Microsoft Graph Search API (https://graph.microsoft.com/beta/search/query) to search files based on their names and content. While the API performs well for most file types, I have noticed that it does not return image files (e.g., PNG, JPG) when the search term matches the title of the image. Here are the key observations: Expected Behavior: When a search term matches the title of an image file, the image should appear in the search results, just as other file types like documents and spreadsheets do. Current Behavior: Image files with titles matching the search term are not being returned in the search results. However, these files are retrievable using their metadata or direct path, suggesting they exist in the index. Additional Notes: Non-image files with matching titles are successfully retrieved. This behavior persists even when explicitly specifying the entityTypes as driveItem. Questions: Is there a limitation in the Microsoft Graph Search API that prevents searching for image files based on their titles? If this is not a limitation, could you provide guidance on how to structure the query to include image files based on their titles? Are there specific configurations or indexing processes required to enable title-based searches for image files? This functionality is critical for our use case, as we need to perform consistent and comprehensive searches across all file types, including images. Your assistance in resolving this issue or providing clarification would be greatly appreciated.HardikAuzmorJan 20, 2025Copper Contributor4Views0likes0CommentsCustom Context button not working in site page (Library as webpart)
I'm facing the issue. Created ListviewCommandset Extension for context menu is working fine on library level and able to see my custom button but when i add the document library as webpart in the site page , I'm not able to get the custom context menu. I have used SP version of 1.19 also 1.20 and 1.16 also. Tried with CSOM code also SP.ClientContext for context. Also tried this.context.listView.SelectedRows. All this are working fine on Document library level not as webpart in site page. Please give any solution to achieve this . Thanks in advanceHariharan2468Jan 17, 2025Occasional Reader5Views0likes0CommentsHow to add buttons in context menu in a Doc Library which is added as a WebPart inside a SP page
Hi, I created list view command set extension application for adding a custom button into the context menu. I have a SharePoint Page in which I added a document library as a webpart. In the Serve.Json of my application I have given this page URL to apply the custom button into the library. Around 2 weeks back this approach worked and the buttons were shown in the context menu but now they are not showing. In a normal document library it is working and showing the Custom button. but in a page where a document library is added as a web part it is not showing. How can we achieve this? What could be the Reason? And Please give me any solution to achieve this functionality. Note: I have tried this solution with different SharePoint Sites but it didn't worked. Thanks in AdvanceShivaram1436Jan 17, 2025Copper Contributor14Views0likes0CommentsAbout SharePoint document library feature (tile view using the Document Card Designer)
I want to display thumbnails and information in the tile view using the document card designer in the SharePoint document library function, but if the number of characters is too long, "・・・" is displayed as shown below and the text is cut off. If you know how to display multiple lines so that the entire text can be displayed, I would appreciate it if you could tell me. *Sharepoint is made on the communication site. < Image >YMMYJan 16, 2025Copper Contributor100Views0likes3CommentsSharepoint modern List choice column with dynamic values
I want to add a column (of type choice/drop down) to an existing sharepoint online modern list. the choice option i want to provide depends on an other column eg. if column A has department sales then column B should have 3 choice options , if column B has department finance then column B should have 4 different options to select. how can i achieve this ?swati8826Jan 13, 2025Copper Contributor16KViews0likes3CommentsHow to stop SharePoint list custom column formatting affecting form display?
Hello, I am trying to apply custom formatting to a multi-select 'Choices' column in a SharePoint list. The custom formatting applies consistent capitalisation to choices, and joins them with a delimiter (required as just applying the style removes spaces between choice items). The custom formatting JSON is as below: { "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "=join(@currentField,', ')", "style": { "text-transform": "capitalize" } } However, when I apply this style to the column through the JSON editor it affects the display of the corresponding field in the form, adding line breaks where they are not wanted, as below. I have tried adding "word-wrap": "nowrap" in the style element of the column format, which works to stop the new lines being added where they are not wanted but prevents logical new lines being added to show all selected elements. I've also tried variations of the "width" property in the style element to try and force the form to use all available space, but to no avail. Interestingly, this only affects 'edit' and 'view' forms (where you are interacting with an existing item) and is not affecting the 'new' form when creating new items. I have custom JSON formatting in the 'Head' section of the form itself, but nothing in the 'Body' or 'Footer' sections. I've tried removing the customisation in the 'Head' but this doesn't resolve the issue. If anyone has any solutions they can offer they would be very much appreciated.SP_RamblerJan 07, 2025Copper Contributor40Views0likes4Comments
Resources
Tags
- developer1,222 Topics
- PnP642 Topics
- apis477 Topics
- Extensibility250 Topics
- Responsive127 Topics
- sharepoint111 Topics
- hybrid81 Topics
- SPFx70 Topics
- SharePoint Online64 Topics
- powershell23 Topics