Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Accessing Sharing Links on List Items: Property SiteId Not Loaded #1440

Closed
1 task done
bajce opened this issue Apr 11, 2024 · 4 comments
Closed
1 task done

Error Accessing Sharing Links on List Items: Property SiteId Not Loaded #1440

bajce opened this issue Apr 11, 2024 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@bajce
Copy link

bajce commented Apr 11, 2024

Category

  • Bug

Describe the bug

When attempting to use the item.File.GetShareLinks() method on items within a List (not a Document Library) which have sharing links, I encounter an error stating that the Property SiteId was not yet loaded. I have tried various methods to explicitly load the SiteId property but none have resolved the issue.

Steps to reproduce

  1. Create a SharePoint List (not a Document Library) and create items with sharing links.
  2. Attempt to retrieve sharing links for the file using the PnP Core SDK method item.File.GetShareLinks().
@jansenbe
Copy link
Contributor

@bajce : can you show me how you've loaded the item?

@jansenbe jansenbe self-assigned this Apr 11, 2024
@jansenbe jansenbe added the question Further information is requested label Apr 11, 2024
@bajce
Copy link
Author

bajce commented Apr 12, 2024

Im loading Items using List#LoadItemsByCamlQuery. But the exception occurs only when loading items of List (not Document Library). As a workaround im currently loading the Sharing Link permissions directly via Graph API.

 list.LoadItemsByCamlQuery(new CamlQueryOptions()
                    {
                        ViewXml = @"<View Scope='RecursiveAll'>
                                        <ViewFields>
                                               <FieldRef Name='FileLeafRef'/>
                                               <FieldRef Name='FileRef'/>
                                               <FieldRef Name='FileDirRef'/>
                                               <FieldRef Name='ItemChildCount'/>
                                               <FieldRef Name='FolderChildCount'/>
                                               <FieldRef Name='UniqueId'/>                              
                                               <FieldRef Name='ParentUniqueId'/>
                                               <FieldRef Name='Title'/>
                                               <FieldRef Name='FSObjType'/>
                                            </ViewFields>
                                       <RowLimit Paged='TRUE'>500</RowLimit>
                                   </View>",
                        DatesInUtc = true,
                        PagingInfo = nextPage
                    },
                    item => item.UniqueId,
                    item => item.FileSystemObjectType,
                    item => item.FieldValuesAsText,
                    item => item.File.QueryProperties(f => f.UniqueId, f => f.SiteId, f => f.VroomItemID, f => f.VroomDriveID),
                    item => item.Folder.QueryProperties(f => f.UniqueId),
                    item => item.HasUniqueRoleAssignments);`

@jansenbe
Copy link
Contributor

jansenbe commented Jun 3, 2024

@bajce : we did not yet implement GetShareLinks for list items as back then the needed Graph APIs were not available. I did cross check on the Graph APIs and today we've not shipped /permissions on a list item (e.g. sites/b56adf79-ff6a-4964-a63a-ff1fa23be9f8/lists/91bb170e-0ef0-4062-86f9-e5dbe8d047bd/items/1/permissions). How are you loading the sharing link permissions via Graph?

@jansenbe
Copy link
Contributor

@bajce : closing per no response for a long time. If needed, please re-open and provide more context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants