developer
1230 TopicsSPFx Webpart - not picking up any styles
I've just upgraded to the latest version of SPFx and when I build a project using yo it all works as expected (no errors), except it doesn't apply any of the styles. I've tried creating multiple projects, and across two different computers, and still the same issue. I've also tried in the workbench and deploying the solution (package). Is anyone else seeing this issue, or anything I need to do? Note that I'm using REACT framework option in the yo setup.19Views1like2CommentsMicrosoft Graph API returns 404 when querying SharePoint file by siteId, listId, uniqueId
I'm retrieving the JSON representation of a SharePoint page using the endpoint: GET https://graph.microsoft.com/v1.0/sites/${siteId}/pages/${pageId}/microsoft.graph.sitePage?expand=canvasLayout&select=id,name,webUrl,title,description,createdBy,canvasLayout,parentReference I receive a JSON structure like this. { "@odata.type": "#microsoft.graph.standardWebPart", "id": "e90803f3-30a5-4ef5-8c7e-1056966a2930", "webPartType": "b4cc345e-35ed-4b30-bc91-a7d6d249494f", "data": { "dataVersion": "1.3", "description": "This is an example description.", "title": "Stream", "properties": { "label": "This is an example property", "isTitleEnabled": true, "templateId": 1, "maxItemsPerPage": 3, "maxRowsPerPageGrid": 5, "maxRowsPerPageTheater": 1, "hideWebPartWhenEmpty": true, "sourceType": "VIDEO", "listSortField": "Created", "playlistSortField": "Default", "isPlaceholderState": false, "dataProviderId": "StreamVideo", "layoutId": "Theater", "webId": "cf329d30-484e-4b9f-9378-533152cfcd3f", "siteId": "6688e890-8000-4a19-9839-905b54adb407", "spWebUrl": "https://example.sharepoint.com/sites/ExampleSite", "previewUrl": "https://example.sharepoint.com/_api/v2.1/sites/example.sharepoint.com,6688e890-8000-4a19-9839-905b54adb407,cf329d30-484e-4b9f-9378-533152cfcd3f/lists/9b049de0-9a77-4169-bd45-6dc32cf99264/items/e2ae18de-a4f2-412d-a5c8-b8e340ef9e90/driveItem/thumbnails/0/c400x99999/content?prefer=noRedirect,extendCacheMaxAge&clientType=modernWebPart", "videoDuration": 145100000, "listId": "9b049de0-9a77-4169-bd45-6dc32cf99264", "rootFolder": "/sites/ExampleSite/Shared Documents/ExampleFolder/movie.mp4", "uniqueId": "e2ae18de-a4f2-412d-a5c8-b8e340ef9e90", "listTitle": "Title Example", "serverRelativePath": "/sites/ExampleSite/Shared Documents/ExampleFolder/movie.mp4", "link": "https://example.sharepoint.com/sites/ExampleSite/Shared Documents/ExampleFolder/movie.mp4", "wopiurl": "/sites/ExampleSite/Shared Documents/ExampleFolder/movie.mp4", "serverRelativeUrl": "/sites/ExampleSite/Shared Documents/ExampleFolder/movie.mp4", "webAbsoluteUrl": "https://example.sharepoint.com/sites/ExampleSite", "file": "https://example.sharepoint.com/sites/ExampleSite/Shared Documents/ExampleFolder/movie.mp4", "query": { "@odata.type": "#graph.Json", "contentLocation": 1, "email address removed for privacy reasons": "#Collection(Int32)", "contentTypes": [ 3 ], "email address removed for privacy reasons": "#Collection(Int32)", "documentTypes": [ 11 ], "sortType": 6 }, "displayMaps": { "1": { "@odata.type": "#graph.Json", "cardType": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "CardType" ] }, "telemetryProperties": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "TelemetryProperties" ] }, "accentColor": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "AccentColor" ] }, "initials": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "Initials" ] }, "previewUrl": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "PreviewUrl", "PictureThumbnailURL" ] }, "headingText": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "SiteTitle" ] }, "itemUrl": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "WebPath" ] }, "listItemId": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "listItemId" ] }, "iconUrl": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "IconUrl" ] }, "activity": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "ModifiedDate" ] }, "spWebUrl": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "SPWebUrl" ] }, "uniqueId": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "UniqueID" ] }, "imageOverlapText": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "ImageOverlapText" ] }, "fileExt": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "FileType" ] }, "tipActionButtonIcon": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "TipActionButtonIcon" ] }, "className": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "ClassName" ] }, "tipActionLabel": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "TipActionLabel" ] }, "imageOverlapTextAriaLabel": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "ImageOverlapTextAriaLabel" ] }, "name": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "Name" ] }, "personImageUrl": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "ProfileImageSrc" ] }, "title": { "@odata.type": "#graph.Json", "email address removed for privacy reasons": "#Collection(String)", "sources": [ "UserName", "Title" ] } }, "@odata.type": "#graph.Json" } }, "serverProcessedContent": { "htmlStrings": [], "searchablePlainTexts": [ { "key": "title", "value": "example_value" } ], "links": [ { "key": "baseUrl", "value": "/sites/SiteExample" } ], "imageSources": [] } } } From the response, I parse out file metadata that’s attached to the page. For each file, I extract the following fields from data.properties: - uniqueId - listId - siteId Then I attempt to retrieve detailed information about the file using the request: GET https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${listId}/items/${uniqueId}/driveItem?select=id,size,parentReference,name,webUrl,file,createdBy,folder This request works for most files. However, for some files—despite having the correct uniqueId, listId, and siteId and even when I can manually verify that the file exists—the request returns a 404 error. I need the detailed JSON response mainly to obtain the webUrl to download the file. My questions are: 1. Why might some files return a 404 even though their metadata appears correct? 2. What alternative approach (e.g., using a different endpoint) can I use to reliably obtain the full JSON details for these file attachments? Any insights or suggestions would be appreciated.80Views0likes1CommentIssue with flat views in SharePoint Online
I use folders within a SharePoint list to organize list items. Additionally, I apply column formatting to update values in a column via button click using customRowAction (setValue). So far, so good... However, when I switch to a flat view (View without folders), this functionality no longer works, and error messages appear. This Error occures for example if I click on any displayed button. This issue occurs exclusively in the flat view and only affects items stored within folders. Additionally, there is another issue when using the Quick Edit feature to set a date field in the flat view. For items located inside a folder, the localization is incorrect. For example, if I select April 1st, SharePoint instead saves January 4th (German Localization). For items located outside a folder or when using a non-flat view, everything appears to function correctly. The attached video provides a demonstration of the issue.192Views13likes2CommentsHow to read file content for a IRM Protected PDF?
I have a SharePoint Document Library with IRM Protection turned on. I need to read content of the IRM Protected PDF file at the code level (.NET API Endpoint). I am able to get the binary content of the file at the code level, but no PDF Reader is able to read the content of the IRM Protected file. Is there a work around?71Views0likes1CommentSharepoint online vermeer packet calls failing against sharepoint online
I am troubleshooting a very old sharepoint integration program we have. We make calls against sharepoint to place documents in it. And we use a very old sharepoint api (Vermeer packets) This is using some very old code that was originally for on-prem sharepoint but which we have patched over the years to work with sharepoint online. We're finding that with one particular customer that we're getting 500 errors along with the text "Operation is not valid due to the current state of the object." when making calls like I'll show below the break. Now this all works in dozens of other customer installs (yes even sharepoint 365 ones). I'm wondering if there are any sharepoint settings anyone knows about that might cause issues like this. Some type of security hardening switch that may have been flipped to dissallow calls like this? It may very well be that MS doesn't allow calls like this anymore in newer environments but that the older ones are grandfathered in. I'd love to see some type of documentation about something like that, but have found none so far. Below is the call and response I'm getting --- We make the http call POST https://CUSTOMER.sharepoint.com/_vti_bin/shtml.dll/_vti_rpc HTTP/1.1 Content-Type: application/x-www-form-urlencoded X-Vermeer-Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; windows NT; MS Search 6.0 Robot) Host: esrtcloud.sharepoint.com Content-Length: 46 Cache-Control: no-cache method=url+to+web+url:6.0.2.5420&url=/&flags=0 And Receive the response HTTP/1.1 500 Internal Server Error Content-Length: 62 P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI" X-NetworkStatistics: 1,525568,0,3568,358383,0,228305,6 IsOCDI: 0 X-DataBoundary: NONE X-1DSCollectorUrl: https://mobile.events.data.microsoft.com/OneCollector/1.0/ X-AriaCollectorURL: https://browser.pipe.aria.microsoft.com/Collector/3.0/ SPRequestGuid: 96d380a1-00cc-8000-1d92-1db10c88e0c6 request-id: 96d380a1-00cc-8000-1d92-1db10c88e0c6 MS-CV: oYDTlswAAIAdkh2xDIjgxg.0 Alt-Svc: h3=":443";ma=86400 Report-To: {"group":"network-errors","max_age":7200,"endpoints":[{"url":"https://spo.nel.measure.office.net/api/report?tenantId=00000000-0000-0000-0000-000000000000&destinationEndpoint=Edge-Prod-EWR31r5b&frontEnd=AFD&RemoteIP=64.20.162.0"}]} NEL: {"report_to":"network-errors","max_age":7200,"success_fraction":0.001,"failure_fraction":1.0} Strict-Transport-Security: max-age=31536000 X-FRAME-OPTIONS: SAMEORIGIN Content-Security-Policy: frame-ancestors 'self' teams.microsoft.com *.teams.microsoft.com *.skype.com *.teams.microsoft.us local.teams.office.com teams.cloud.microsoft *.office365.com goals.cloud.microsoft *.powerapps.com *.powerbi.com *.yammer.com engage.cloud.microsoft word.cloud.microsoft excel.cloud.microsoft powerpoint.cloud.microsoft *.officeapps.live.com *.office.com *.microsoft365.com m365.cloud.microsoft *.cloud.microsoft *.stream.azure-test.net *.microsoftstream.com *.dynamics.com *.microsoft.com http://onedrive.live.com *.onedrive.live.com securebroker.sharepointonline.com; SPRequestDuration: 11 SPIisLatency: 1 X-Powered-By: http://ASP.NET MicrosoftSharePointTeamServices: 16.0.0.25722 X-Content-Type-Options: nosniff X-MS-InvokeApp: 1; RequireReadOnly X-Cache: CONFIG_NOCACHE X-MSEdge-Ref: Ref A: 203E3FC24FC84560B6FBE9F468E72B68 Ref B: EWR311000104035 Ref C: 2025-02-12T16:44:53Z Date: Wed, 12 Feb 2025 16:44:52 GMT Operation is not valid due to the current state of the object. For comparison, a successful response to the call looks like this HTTP/1.1 200 OK Server: Microsoft-IIS/10.0 Date: Wed, 12 Feb 2025 20:45:51 GMT Connection: close Content-type: text/html; charset=utf-8 <html><head><title>vermeer RPC packet</title></head> <body> <p>method=url to web url:6.0.2.5420 <p>webUrl=/ <p>fileUrl= </body> </html>55Views0likes1CommentGetting all the pages of a site in the template
I am new in SharePoint and trying to get the template of a site and all the pages of it using the cmdlet: Get-PnPSiteTemplate -Out .\template.xml I am not getting more than the homepage. I need to get all the pages in the template to provision later another sites directly using the cmdlet: Invoke-PnPSiteTemplate -Path template.xml If you know if it is not possible or how to do it I would be really thankful!Solved3KViews0likes2Comments401 unauthorised for ExecuteQuery in sharepoint CSOM
Hi, I am trying to connect the sharepoint site with client id and secret but getting 401 unauthroised error while hitting the executequery() method. While doing app registrations both Microsoft graph and share point API permissions with full site control has been given including trusted the app through appinv.aspx. Still getting 401 unauthorised error. Since ACS is retiring, do we need to follow any other permissions for share point level site access. The same execute query is working fine for client id, certificate combination. But not working for client id and secret. static void Main(string[] args) { var authManager = new AuthenticationManager("***************************", "C:\\Program Files\\OpenSSL-Win64\\bin\\certificate.pfx", "*******", "********.onmicrosoft.com"); using (var cc = authManager.GetContext("https://****.sharepoint.com/sites/****")) { cc.Load(cc.Web, p => p.Title); cc.ExecuteQuery(); Console.WriteLine(cc.Web.Title); ListCollection listCollection = cc.Web.Lists; cc.ExecuteQuery(); // this is working fine }; // Replace with your SharePoint Online details string siteUrl = "****************************"; string tenantId = "***************************"; string clientId = "********************************"; string clientSecret = "******************************"; // App secret try { using (var context = GetClientContextWithOAuth(siteUrl, tenantId, clientId, clientSecret)) { // Example: Retrieve web title Web web = context.Web; context.Load(web, w => w.Title); context.ExecuteQuery(); // this is throwing 401 unauthorized error Console.WriteLine("Connected to: " + web.Title); } } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); } } private static ClientContext GetClientContextWithOAuth(string siteUrl, string tenantId, string clientId, string clientSecret) { // Azure AD OAuth 2.0 endpoint string authority = $"https://login.microsoftonline.com/*******************"; // Use MSAL to acquire an access token var app = ConfidentialClientApplicationBuilder.Create(clientId) .WithClientSecret(clientSecret) .WithAuthority(new Uri(authority)) .Build(); var authResult = app.AcquireTokenForClient(new[] { $"{siteUrl}/.default" }).ExecuteAsync().Result; if (authResult == null) { throw new Exception("Failed to acquire the access token."); } // Use the access token to authenticate the ClientContext var context = new ClientContext(siteUrl); context.ExecutingWebRequest += (sender, e) => { e.WebRequestExecutor.WebRequest.Headers["Authorization"] = "Bearer " + authResult.AccessToken; }; return context; }61Views0likes0CommentsHow 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, Mario121Views0likes1Comment