The file is stored in the List Documents.
List list = clientcontext.Web.Lists.GetByTitle("Documents");
You can use the cmdlet Search-UnifiedAuditLog to search the unified audit log, which requires the Exchange Online PowerShell V2 module to work.
See the sample script via this link: SharePoint Online: How to View Audit Log Reports in Security & Compliance Center?
You can find the available Operations on Site permissions activities here.
Changes to permissions can be audited using Audit Log Reports. You will need to enable Auditing to view these reports.
In Microsoft 365, you can also use the Security and Compliance Center to view audit logs from across multiple applications including SharePoint.
This is just not possible. If the users donot have access to the admin center, they can only create site collections with modern template(communication sites and team sites).
The rest api you used is only available for Communication sites and non-group associated Team Sites.https://docs.microsoft.com/en-us/sharepoint/dev/apis/site-creation-rest
To create ...
Silly me. The resolution is to delete the relevant cookies from the machine, after which the next execution of the script surfaces the prompt again, in this case allowing me to provide the correct credentials for tenant-2.
SharePoint 2013 workflow and SharePoint 2010 workflows are different, so you have to use different ways to cancel it.
This article would help you:
Below is my demo code for your reference:
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
You can use the following PowerShell command for SharePoint on-premises:
Set-SPSite -Identity "<SiteURL>" -LockState "ReadOnly"
References:Set-SPSite. / SharePoint 2013: Set Site Collection to Read Only.
Here is another sample script which can be executed using Windows PowerShell:
This can be achieved using Site Policies:
Create a site policy with the option "The site collection will be read only when it is closed." ticked. Ensure that you do not set the site to close or delete automatically unless this is desired.
Using the UI, the policy can be applied by going to Site Settings > Site Closure and Deletion, set the ...