Forum Widgets
Latest Discussions
Event Listeners Not Working After Translating SharePoint Page with SPFx Extension
Hello everyone, I'm developing a SharePoint Framework (SPFx) extension to translate SharePoint pages using a language viewer API. The extension includes a dropdown menu for language selection, and it successfully translates the page content based on the selected language. However, after the translation, all event listeners attached to elements on the page, such as the "Add New" functionality of the out-of-the-box (OOTB) list web part, stop working. Here are the steps I've taken so far: Reattached event listeners after applying translations. Despite these efforts, the issue persists. Has anyone encountered similar problems or have any suggestions on how to resolve this? Any insights or solutions would be greatly appreciated! Thank you in advance for your help!VarshaTiwariApr 17, 2025Occasional Reader2Views0likes0CommentsSharepoint Online: fastest way to retrieve folder count in a document library
Hi all I'm really looking for what the title says. Right now I'm doing Get-PnPFolderItem -ItemType Folder (using Pnp.Powershell but can try other options) but with more than a few 10s of folders, this is REALLY slow. The thing is, I just need a count (recursively), not all info as I'm getting with Get-PnPFolderItem. Any ideas?SolveddandrakaApr 09, 2025Copper Contributor33Views0likes1CommentMicrosoft 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.whisperwind325Apr 02, 2025Copper Contributor72Views0likes1CommentSPO connection via client id/secret
hi all, I am trying to get the SPO site name but when running locally I get this error: "Invalid RedirectURI was received. Not parseable into System.Uri class." I thought you can use client id/secret with proper api permission to connect to SPO with no issues... Below the code I use. Thanks! ------------------------ Imports Microsoft.SharePoint.Client Imports System.Net Imports System.Security Imports PnP.Frameworks Public Class index Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim siteUrl As String = "https://mysite.sharepoint.com/sites/admin" Dim clientId As String = "xxxxxxxxx" Dim clientSecret As String = "yyyyyyyyy" Dim tenantId As String = "555555555555" Dim siteName As String = GetSharePointSiteName(siteUrl, clientId, clientSecret, tenantId) Label1.Text = ("Site Name: " & siteName) End Sub Function GetSharePointSiteName(siteUrl As String, clientId As String, clientSecret As String, tenantId As String) As String Dim authManager As New PnP.Framework.AuthenticationManager(clientId, clientSecret, tenantId) Using context As ClientContext = authManager.GetContext(siteUrl) Dim web As Web = context.Web context.Load(web, Function(w) w.Title) context.ExecuteQuery() Return web.Title End Using End Function End ClassAMG365Apr 02, 2025Copper Contributor64Views0likes1CommentFailed to get FormDigestValue with 403 Forbidden in java
Hello Everyone, This is my first time to access sharepoint via java in my project. I used AI to get varies of java code and try to connect to sharepoint to get FormDigestValue as step one (The target is to upload files). Somehow it always return 403. Could you please help to figure out the root cause? I appreciate for any comments. I struggle with the problem for several days already. Code 1: System.setProperty("sun.net.http.allowRestrictedHeaders", "true"); URL urlRequest = new URL(siteUrl + "/_api/contextinfo"); HttpURLConnection contextInfoRequest = (HttpURLConnection) urlRequest.openConnection(); contextInfoRequest.setRequestProperty("Content-Type", "application/json;odata=verbose"); contextInfoRequest.setRequestProperty("Accept", "application/json;odata=verbose"); contextInfoRequest.setRequestProperty("Connection", "Keep-Alive"); contextInfoRequest.setRequestProperty("Content-Length", "0"); contextInfoRequest.setDoOutput(true); contextInfoRequest.setRequestMethod("POST"); String authStr = username + ":" + password; String encodedAuthStr = Base64.getEncoder().encodeToString(authStr.getBytes()); contextInfoRequest.setRequestProperty("Authorization", "Basic " + encodedAuthStr); contextInfoRequest.connect(); InputStream in = contextInfoRequest.getInputStream(); -- 403 here Code 2: System.setProperty("sun.net.http.allowRestrictedHeaders", "true"); URL urlRequest = new URL(siteUrl + "/_api/contextinfo"); HttpURLConnection contextInfoRequest = (HttpURLConnection) urlRequest.openConnection(); contextInfoRequest.setRequestProperty("Content-Type", "application/json;odata=verbose"); contextInfoRequest.setRequestProperty("Accept", "application/json;odata=verbose"); contextInfoRequest.setRequestProperty("Connection", "Keep-Alive"); contextInfoRequest.setRequestProperty("Content-Length", "0"); contextInfoRequest.setDoOutput(true); contextInfoRequest.setRequestMethod("POST"); Authenticator.setDefault(new Authenticator() { @Override public PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(domain + "\\" + username, password.toCharArray()); } }); contextInfoRequest.connect(); InputStream in = contextInfoRequest.getInputStream(); -- 403 here Code 3: // Create the SharePoint context HttpClient client = createHttpClient(); String authHeader = getBasicAuthHeader(shareac, sharepw); // Example request to SharePoint HttpRequest request = HttpRequest.newBuilder().uri(URI.create(galurl + "/_api/contextinfo")) .header("Authorization", authHeader) .header("Accept", "application/json;odata=verbose") .POST(HttpRequest.BodyPublishers.ofString("")) .build(); HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println("Response Status Code: " + response.statusCode()); -- 403 here Code 4: // 设置SSL协议 SSLContext sslContext = SSLContext.getInstance("TLSv1.2"); sslContext.init(null, null, null); HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); // 创建HttpClient CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); credentialsProvider.setCredentials(new AuthScope(galurl, -1, AuthScope.ANY_REALM), new UsernamePasswordCredentials(shareac, sharepw)); CloseableHttpClient httpClient = HttpClients.custom() .setDefaultCredentialsProvider(credentialsProvider) .build(); // 使用httpClient进行请求 // 示例:发送GET请求 HttpGet httpget = new HttpGet(galurl); HttpResponse response = httpClient.execute(httpget); // 处理响应 int statusCode = response.getStatusLine().getStatusCode(); System.out.println("Response status code: " + statusCode); -- 403 hererickyhuang2025Mar 31, 2025Copper Contributor20Views0likes0CommentsHow to use operators in URL filters?
Hi! I'm trying to use the Contains filter operator in my modern SharePoint list, and it's ignoring that parameter. I've tried using a greater-than operator with a numeric field, and it also ignores that. https://xxxxxxx.com/sites/xxxxxxx/Lists/xxxxxxx/xxxxxx.aspx?FilterField1=status&FilterOp1=Contains&FilterValue1&pend&FilterType1=Text I want it to return all results that contain "pend" in the status column. How should I use it? I can't use the view configuration because the filtering is meant to be dynamic. The user, using an SPFx ListViewCommandSet extension, has a button that allows them to filter with operators. We're really stuck on this. Thanks!FjDevCorMar 27, 2025Copper Contributor314Views0likes3CommentsSharepoint app only key renewal
Hi Guys We have a SharePoint app only created in 2020 and we successfully renewed that 3 years back This app integration used for time-critical application we hear that Microsoft is going to discontinue SharePoint app-only authentication April 2026 somehow our app key needed to be renewed in coming May 2025 we have found this script to do the renewal, but can you guys confirm this app key renewal is still valid ? https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/replace-an-expiring-client-secret-in-a-sharepoint-add-in Best Regards RadikaRadika_KoralearachchiMar 27, 2025Copper Contributor120Views0likes2CommentsIssue 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.Jan HennemannMar 26, 2025Brass Contributor180Views13likes2CommentsHow to get list items from one SharePoint tenant to another SharePoint tenant
Requirement: We have developed task management solution which can be deployed at any SharePoint site and I wanted to pull tasks from SharePoint site in different tenant to my tenant SharePoint site and show them in task dashboard. We have used SharePoint Framework (SPFx) to develop this dashboard, and we are ready to accommodate any other technology also if that fulfills requirement. Please suggest if this is possible to do and what should be approach? Thanks, DeepakDeepak1981Mar 26, 2025Copper Contributor18Views0likes0CommentsIssue with SharePoint Add-in Uninstalling After Renaming App Web url
We are migrating customers from the retired SharePoint Add-in model to the new SPFx model. As part of this, we automatically rename the App Web (created during Add-in installation) and changing its URL and create a new subsite with the original App Web’s name & URL to host the SPFx app and its content. However, when the customer later uninstalls the Add-in, SharePoint deletes the new subsite instead of the original App Web, which still exists under its renamed URL. This suggests that the installed Add-in is not aware of the App Web renaming/changed URL, causing it to target the wrong site for deletion. Our migration process relies on preserving existing links by maintaining the original App Web URL for the new subsite. Is there a way to update the installed Add-in to recognize the renamed App Web? Alternatively, is there a recommended approach to prevent the unintended deletion of the new subsite when the Add-in is uninstalled?Ross_CullenMar 21, 2025Copper Contributor23Views0likes0Comments
Resources
Tags
- developer1,229 Topics
- PnP646 Topics
- apis483 Topics
- Extensibility251 Topics
- Responsive128 Topics
- hybrid81 Topics
- SPFx70 Topics
- SharePoint Online64 Topics
- powershell23 Topics
- CSOM15 Topics