View UserNotFoundIssueFix
FieldUserValue authorUser = (FieldUserValue) listItem["Author"]; | |
User author = web.EnsureUser(authorUser.LookupValue); | |
bool byPassAuthorCreation = false; | |
try | |
{ | |
context.Load(author); | |
context.ExecuteQuery(); | |
}catch(Exception ex) | |
{byPassAuthorCreation=true;} |
View Azure WCF Data Service Method
public static void InitializeService(DataServiceConfiguration config) | |
{ | |
// TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc. | |
config.SetEntitySetAccessRule("*", EntitySetRights.AllRead); | |
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3; | |
config.UseVerboseErrors = true; | |
} |
View Library creation with Template
ListTemplateCollection templates = context.Site.GetCustomListTemplates(context.Web); | |
context.Load(templates); | |
context.ExecuteQuery(); | |
log.Info("Templates Loaded"); | |
// Initialize list or library creation info | |
var template = templates.First(listTemp => listTemp.Name == "<name of template>"); | |
var listCreationInfo = new ListCreationInformation(); | |
listCreationInfo.Title = LibName; |
View Permissions Management
log.Info("Inheriting permissions"); | |
//Inherit permissions if broken | |
rListitem.ResetRoleInheritance(); | |
transList.ResetRoleInheritance(); | |
log.Info("Now let's start breaking the permissions again"); | |
// Break permissions | |
rListitem.BreakRoleInheritance(false, false); | |
transList.BreakRoleInheritance(false, false); | |
RoleAssignmentCollection collRoleAssign = destList.RoleAssignments; |
View Azure WCF Service
public static void InitializeService(DataServiceConfiguration config) | |
{ | |
// TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc. | |
// Examples: | |
config.SetEntitySetAccessRule("*", EntitySetRights.AllRead); | |
// config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All); | |
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3; | |
config.UseVerboseErrors = true; | |
} |
View property bag update normal
context.Web.AllProperties[“PropertyBagValue1”] = “Property” | |
context.Web.Update() | |
context.Web.ExecuteQuery() |
View Update property bag modern SP site
using Microsoft.Online.SharePoint.TenantAdministration; | |
using (var contextTenant = new ClientContext(<spTenantUrl>)) | |
{ | |
contextTenant.Credentials = new SharePointOnlineCredentials(<username>, <secpass>); | |
Tenant tSP = new Tenant(contextTenant); | |
tSP.SetSiteProperties(<groupurl>, noScriptSite: false); | |
contextTenant.ExecuteQuery(); | |
} | |
contextGroup.Web.SetPropertyBagValue("ProvisioningStatus", "Completed"); |
View JSON Custom List through Site Script
{ | |
"$schema": "schema.json", | |
"actions": [ | |
{ | |
"verb": "applyTheme", | |
"themeName": "Custom Dark Blue custom" | |
}, | |
{ | |
"verb": "createSPList", | |
"listName": "Training Registration", |
View JSON Request Trigger Site Script in Flow
{ | |
"type": "object", | |
"properties": { | |
"webUrl": { | |
"type": "string" | |
}, | |
"parameters": { | |
"type": "object", | |
"properties": { | |
"event": { |
View PnP PowerShell Apply Template
Write-Output "Incoming request for '$in'" | |
Connect-PnPOnline -AppId $env:AppId -AppSecret $env:AppSecret -Url $in | |
Write-Output "Connected to site" | |
Apply-PnPProvisioningTemplate -Path D:\home\site\wwwroot\<function name>\<template>.xml |
OlderNewer