PnP
729 TopicsImporting JSON as a list in SharePoint Online via pnp
I'm trying to import a JSON list file to my Sharepoint online website. But it seems impossible to import it directly. Does anyone know a possibility via pnp because I saw a method on pnp named "fromJson" but I don't know how to use it to import my files to my SharePoint website. Thanks in advance!16Views0likes0CommentsGetting 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; }39Views0likes0CommentsHow 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, Mario84Views0likes1CommentManaged metadata showing up randomly in lists (might be PnP Provisioning related)
Dear people, I have SharePoint sites with a lot of lists each containing a couple of managed metadata columns. The sites are defined in a template and get rolled out via PnP provisioning. I did that many times before and never had this: The lists show a weird behavior: some items get randomly the value of a specific managed metadata (it's always the same). None of the columns have set a default value. All lists have only list content types - no site content types. The lists where the metadata shows up don't even have a column where this metadata is set. I was suspecting the -1 setting in the default value in the columns to connect to the Hidden Taxonomy List so I removed all default values. But the issue persists. Has anyone ever experienced this? Thank y'all!28Views0likes0CommentsSharePoint Authentication using PnP Framework
Hi guys, Looking for some advice. Does anyone have an idea of how can we connect to SharePoint using Client Id - Client Secret authentication in Web API using PnP Framework tool? Right now, we use "SharePoint PnP Core Online" tool but this tool is now deprecated. Any help will be appreciated. Thank You.14KViews0likes4CommentsCurious: Are SPFx Extensions Supported in OneDrive?
Hi everyone, 👋 I'm fairly new to the SharePoint Framework (SPFx) world and have been exploring its possibilities. It's been an exciting journey so far, but I’ve hit a bit of a question that I couldn't find a clear answer to. Does anyone know if SPFx extensions are supported in OneDrive? I understand they work great in SharePoint, but I’m wondering if we can extend the same functionality to OneDrive. If not, does anyone have insights into whether there’s a chance that Microsoft might bring SPFx extensions to OneDrive in the future? I’d love to hear your thoughts or any advice you have to share! Thanks for taking the time to help. 😊 Cheers, Sachin46Views1like0CommentsForm Customization Permissions?
1. I wrote a SharePoint form customization using SPFx ( TypeScript / React ). 2. I have a large pool of external users and each month I will send emails to a portion of those users. 3. The email will contain a link back to a page on my SharePoint site. 4. The page on the site will contain one or more links to list items that require the user to edit and save. 5. When the user clicks on one of those links, the corresponding list item will be displayed using my form customization. 6. The user will edit the information, save the form, and be directed back to the site page with the links to the list items. Everything works fine up to (and including) #4. However, when the user clicks on one of those links, only a blank page appears and using F12 I see the following: ----------------------------------------------------------------------------------------------------------------- Refused to execute script from 'https://<tenant>/sites/appcatalog/_layouts/15/AccessDenied....' because it's MIME type ('text/html') is not executable, and string MIME type checking is enabled ----------------------------------------------------------------------------------------------------------------- The users are all included in the "members" group of the site and should have edit permissions. However, this error message seems as though there is some permission missing from the actual form customization application that I deployed to the app catalog and then enabled on this specific site. Internal users do not experience this issue, only external users. Are there permissions I need to configure on a form customization application?74Views0likes0CommentsProgrammatically share site with external users via passcode
Hello, I have a large pool of persons external to my organization. Once a year they must complete a form that takes maybe 10-15 minutes to fill out. Each month I would like to send an email to some number of these people informing them that they must complete their form. I would like to do the following things programmatically (SPFx using React/Typescript): Use the user's email address to see if they are already in the "FormMembers" group. If not, add them Send them a notification email with a link to page that will itself will have a link to the edit form for the form they must complete (this is a form customization, again SPFx using React/Typescript) I want them to be able to access the site and form using a passcode that has an expiration date. I want to create and send the email programmatically I DO NOT want to require them to authenticate with anything other than the passcode. This is an annual event for them tha lasts only a few minutes. Question: How do I programmatically create the link that I put in the email so that it will know to authenticate using a passcode?75Views0likes0Comments