I recently ran into a problem that it was impossible to load users from a SharePoint group using SharePoint Rest API or CSOM.
Weiterlesen „CSOM: Access Denied when loading users from a group“Kategorie: CSOM
CSOM: Set primary set collection admin
When creating modern site collections (e.g. sites with STS#3 Base Template) in SharePoint Online using CSOM the creator of the site will be automatically set as site owner and afterwards becomes site collection administrator afterwards.
To prevent this you have to change to primary site admin, remove old admin user from the site collection admins. This can be done in CSOM using the following logic.
Weiterlesen „CSOM: Set primary set collection admin“
Set Site Collection Readonly programmatically using (new version)
Some time ago a I have posted some example code to set a site collection read only using a site policies and CSOM.
Now it is also possible to directly set a site collection readonly programmatically without a site policy. Weiterlesen „Set Site Collection Readonly programmatically using (new version)“
CSOM: Check if a date is in a webs workdays and / or workhours
The following function checks if a datetime is in the workdays and / or workhours of a SharePoint web.
Weiterlesen „CSOM: Check if a date is in a webs workdays and / or workhours“
CSOM: Check if a site is a modern site
The following Code checks if a site collection is a modern site (e.g. because it has a group connected or it is communication site).
Weiterlesen „CSOM: Check if a site is a modern site“
CSOM: Check if a web is the root web of a site collection
The following extension method checks if a web is the root web of a site collection:
Weiterlesen „CSOM: Check if a web is the root web of a site collection“
Check if a field is a build in field using CSOM
The following function checks if a sharepoint field is a build in field or a custom field.
Weiterlesen „Check if a field is a build in field using CSOM“
PNP PowerShell: Copy local term group from one Site Collection to another
The following function copies the local termgroups of one site collection to another site collection using the PNP PowerShell provisioning cmdlets.
The template is applied in memory using the Get-PnPProvisioningTemplate -OutputInstance parameter and the Apply-PnPProvisioningTemplate -InputInstance commands.
Weiterlesen „PNP PowerShell: Copy local term group from one Site Collection to another“
CSOM: Get ClientContext from absolute url
The following method shows how to get a ClientContext from an absolute url.
Weiterlesen „CSOM: Get ClientContext from absolute url“
CSOM: Get parent folder of a file
Since SharePoint 2013 the SharePoint Client API has a property to load the parent folder of a list item. For some unkown reasons this property does not work as intended.
Weiterlesen „CSOM: Get parent folder of a file“