Which is not to say that there isn’t a learning curve here, and before going over the solution we should introduce some basic concepts. More importantly, Graph calls can be easily made via PowerShell, and in turn, the output can be transformed into objects, requiring only basic programming experience to achieve the task at hand. The Graph can be a very useful tool, even in the hands of a non-developer. Can the Graph API help?Įnter the Graph API, offering a simple, unified model, where different objects, their attributes, and relations to other objects can be queried via straightforward HTTP URIs from a single endpoint. Which is essential before running anyĬode you’ve found online. For an IT Pro like myself, solutions based on these approachesĬan be a bit overwhelming to understand. REST API, but those will only appeal to people with extensive SharePointĭev background. Some moreĮlaborate solutions involve the use of SharePoint Items using this method is impossible, unless you’re exporting and storing pastĪnother alternative, but they clearly misunderstand the goal here. However, as the audit logs only retainĮvents for a limited duration, building a comprehensive inventory of all shared The address of the person a given file was shared with, but also whether the The additional data exposed in the events can reveal not just Office 365 Unified Audit log for any sharingĪctivities. This method, however, will not give you any information about the type of sharing (whether it’s a sharing invitation or anonymous link, for example), and more importantly, it will not give you details as to whom the file was shared with. With the built-in tools, the closest you can get to an actual list is an exportable report, where you have to run an eDiscovery/Content search with the ViewableByExternalUsers keyword to download. To date, Office 365 does not offer any functionality to answer this question. Run the below commands to list the recently created (or uploaded) documents.Every day I like to browse the different Office 365 communities, and I often run into questions like “how do I list all externally shared files”. The above commands store the details in the array object “ $Result“, we can generate the required report from this result array. $Result | Export-CSV "C:\SharePoint-Files.CSV" -NoTypeInformation -Encoding UTF8 ModifiedByEmail = $įileSize_KB = ::Round(($item.FieldValues/1024), 2) #File size in KB RelativeURL = $item.FieldValuesĬreatedByEmail = $ĬreatedTime = $item.FieldValues $Result += New-Object PSObject -property = $item.FieldValuesįileType = $item.FieldValues Write-Progress -activity "Processing $($item)" -status "$i out of $TotoalFiles completed" $credentials = New-Object ($adminAccount,$secPwd) $secPwd = $(ConvertTo-SecureString $adminPwd -asplaintext -force) #Connect and Load SharePoint Library and Root Folder #Specify SharePoint Online Site URL or User's OneDrive Site URL $Result = SharePoint or OneDrive site admin account #Add required references to SharePoint client assembly to use CSOM To use CSOM in PowerShell, we need to install Microsoft SharePoint Online Client SDK components and load the required assembly files. The following script retrieves all the file documents from the given site document library and exports the document metadata details (such as file name, file path, document id, file size, file created time, last modified time, author name, and last modified user email ) to a CSV file. Find all files modified by a specific userĮxport all documents and metadata details.Find all files created by a specific user.Export all documents and metadata details.Using the below script, you can generate the following documents inventory reports. We can easily get all list items with the required CAML query using the CSOM script. In SharePoint Online, the document files are represented as List items under the Document Library list. The script also exports file details to a CSV file. In this post, we will share CSOM based PowerShell script to get a list of all documents and metadata details from SharePoint Online or OneDrive for Business site.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |