User Profile
Audi86
Brass Contributor
Joined 8 years ago
User Widgets
Recent Discussions
Error while running CSOM code : Error: Cannot find an overload for "WorkflowServicesManager"...
Hi, I am trying t get the list of all running 2013 workflows on our SharePoint online env. . I tried running PnP and CSOM code but continuously getting this error after inserting credentials in VS code Error: Cannot find an overload for "WorkflowServicesManager" and the argument count: "2". has workflow service manager depreciated?771Views0likes1CommentRe: Extract PSTN and SMS usage from Teams using powershell or Graph
davidlime160Thank you, let me test it out. i see you have used a Url involving Microsoft Graph. Do i need any permissions beyond Teams admin to use this url. i have been using pnp but never used graph so just wondering?4KViews0likes0CommentsLooking to add a line to check for existing email if already there
Hi, I have researched and came up this code to add email added in the access request field in SharePoint Subsites. I tested the script and its working fine. I am looking to modify this script to see if there is already an email present then dont overwrite it to my email. Can you advise how to create that check. Can you please advise on my code below or any link that will help me to modify: $SiteURL = "https://MySite.sharepoint.com"; $Cred = Get-Credential Try { Connect-PnPOnline -Url $SiteURL -Credentials $Cred $subwebs = Get-PnPSubWeb -Recurse foreach ($Subweb in $subwebs) { Write-Host $Subweb.Url $web = Connect-PnPOnline -Url $Subweb.Url -Credentials $Cred Set-PnPRequestAccessEmails -Emails @("email address removed for privacy reasons") } } catch { write-host "Error: $($_.Exception.Message)" -foregroundcolor Red }Solved1.1KViews0likes2CommentsError when invoke PnP Template from legacy team site to modern team site
Hi , we have a legacy team site, which has a document library with 2013 workflows migrated in it. We want to create a test document library same columns under modern team site and perform some test on them. While deploying the exported template we are getting following error which seems like causing due to legacy and modern site difference. is there any work around that we can just move the document library to modern site with out any items in it? Error: Invoke-PnPSiteTemplate : Referenced content type 0x0120D520 not available in site or in template After some research, found this article but not sure how to use the fix in my case? https://techcommunity.microsoft.com/t5/sharepoint-developer/pnp-provisioning-framework-referenced-co... Thanks599Views0likes0CommentsRe: get warning WARNING: Parameter 'Web' is obsolete. The -Web parameter will be removed in a future
hi LainRobertson here is my code, can yo guide me with respect to that? I am trying to add an existing sharepoint group to all subsites under site collection $SiteURL = "https://abc.sharepoint.com/sites/MyProject" $Cred = Get-Credential Try { Connect-PnPOnline -Url $SiteURL -Credentials $Cred $subwebs = Get-PnPSubWeb -Recurse foreach ($Subweb in $subwebs) { Write-Host $Subweb.Url $Answer = Read-Host -Prompt "Do you want to continue adding group to subsites (y or n or break)?" if ($Answer -eq "n") { Continue } if ($Answer -eq "break") { break } Add-PnPGroup -Identity 'PMO Team' -web $Subweb -AddRole Read } } catch { write-host "Error: $($_.Exception.Message)" -foregroundcolor Red }1.6KViews0likes1Commentget warning WARNING: Parameter 'Web' is obsolete. The -Web parameter will be removed in a future
hi, While using a pnp script I got a warning as below. Can you advise how to remove the warning WARNING: Parameter 'Web' is obsolete. The -Web parameter will be removed in a future release. thanks1.7KViews0likes3CommentsNeed to add SharePoint existing group to all the subsites in a project site
hi, we have a project site and under that we have almost thousand subsites with unique permission. we are facing a challenge where there is a sharepoint group with Read permission and its only assigned to site collection level. we want this group to be assigned to all subsites as well. i got a script below and wanted to make sure if this will do the job for us to add the already existing SP group to all subsites? Also want to make sure the email should not be broadcasted to group members when they are added to subsites. Also if i can add the human interaction after every loop to go one by one to make sure we are not screwing permission, that would be great. thanks. Connect-PnPOnline -Url https://domain.sharepoint.com/ProjectSite Function Get-Subsites() { $subwebs= Get-PnPSubWebs -Recurse foreach ($Subweb in $subwebs) { Set-PnPGroupPermissions -Identity 'spgroup1' -web $Subweb -AddRole Read } } Get-SubSites1.2KViews0likes0CommentsRe: Powershell for sharepoint online
hi AndresGorzelany This code did some stuff. Renamed the old categories and created the new Categories but my URL didn't update to new categories, any advise for this ? I reset Site Features manually from site settings Connect-PnPOnline -Url https://[your-tenant].sharepoint.com/sites/[your-site] $categorieslist = Get-PnPList -Identity "[GUID of the list you want to move]" $categorieslist.Title = "Categories_old" $categorieslist.RootFolder.MoveTo("https://[your-tenant].sharepoint.com/sites/[your-site]" + "/lists/categories_old") $categorieslist.Update() Invoke-PnPQuery Write-Host "Categories list issue fixed..."3.9KViews0likes1CommentPowershell for sharepoint online
Hi, I have a powershell script related to SharePoint 2013 server. Can this be converted to work on online, as the site is community site template which was available in SharePoint 2013 and its also available in SharePoint online. we are having an issue with community SharePoint site online and need to use the same script which fixed the issue on SP 2013 community site. Below is the script $web = Get-SPWeb <Affected web URL here> $categorieslist = $web.Lists["Categories"] $categorieslist.Title = "Categories_old" $categorieslist.RootFolder.MoveTo($web.Url + "/lists/categories_old") $categorieslist.Update() Write-Host "Categories list issue fixed..." Disable-SPFeature -Identity CommunitySite -Url $web.Url Enable-SPFeature -Identity CommunitySite -Url $web.Url Write-Host "Community Site Feature reactivated..."Solved4.1KViews0likes3CommentsConverting code to run on single item by disabling for loop
hi, Below i have a chunk of code which is running on each item in my SharePoint online classic document library using a for loop. I want to modify it as a test to run on a single item or any specific item by disabling for loop. How can I achieve that? Thanks #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" Add-Type -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.WorkflowServices.dll" #Set Parameters $SiteURL="https://xxxx.sharepoint.com/sites" $ListName =" Documents" #Get Credentials to connect $Cred= Get-Credential Try{ #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password) #Get the Web, List and List Item Objects $Web = $Ctx.Web $Ctx.Load($Web) $List = $Web.Lists.GetByTitle($ListName) $ListItems = $List.GetItems([Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery()) $Ctx.Load($List) $Ctx.Load($ListItems) $Ctx.ExecuteQuery() #Initialize Workflow Manager and other related objects $WorkflowServicesManager = New-Object Microsoft.SharePoint.Client.WorkflowServices.WorkflowServicesManager($Ctx, $Web) $WorkflowSubscriptionService = $workflowServicesManager.GetWorkflowSubscriptionService() $WorkflowInstanceService = $WorkflowServicesManager.GetWorkflowInstanceService() $WorkflowAssociations = $WorkflowSubscriptionService.EnumerateSubscriptionsByList($List.Id) $Ctx.Load($WorkflowAssociations) $Ctx.ExecuteQuery() #Loop through each List Item ForEach($ListItem in $ListItems) { #Get Workflow Instances of the List Item $WorkflowInstanceCollection = $WorkflowInstanceService.EnumerateInstancesForListItem($List.Id, $ListItem.Id) $Ctx.Load($WorkflowInstanceCollection) $Ctx.ExecuteQuery() #Get all Workflow Instances in progress ForEach ($WorkflowInstance in $WorkflowInstanceCollection | Where {$_.Status -eq "Suspended"}) { [PSCustomObject] @{ ItemID = $ListItem.ID Status = $WorkflowInstance.Status WorkflowStarted = $WorkflowInstance.InstanceCreated WorkflowAssociation = $WorkflowAssociations | where {$_.ID -eq $WorkflowInstance.WorkflowSubscriptionId} | Select -ExpandProperty Name ItemUrl = "$($Web.Context.Web.Url)/$($workflowInstance.Properties["Microsoft.SharePoint.ActivationProperties.CurrentItemUrl"])" StartedBy = $workflowInstance.Properties["Microsoft.SharePoint.ActivationProperties.InitiatorUserId"] } <# $WorkflowInstanceService.TerminateWorkflow($WorkflowInstance) Read-Host -Prompt "Do you want to Terminate this instance:" $Ctx.ExecuteQuery() Write-host -f Green "'$($WorkflowAssociations | where {$_.ID -eq $WorkflowInstance.WorkflowSubscriptionId} | Select -ExpandProperty Name)'is Terminated"#> } } } Catch { Write-host -f Red "Error:" $_.Exception.Message }Solved2.7KViews0likes13CommentsRe: Add a line to skip or continue loop execution
nevermind I got it with following code. Thanks alot all! $Answer = Read-Host -Prompt "Do you want to Terminate this instance (y or n)?" if ($Answer -eq "n") { Continue } $WorkflowInstanceService.TerminateWorkflow($WorkflowInstance) $Ctx.ExecuteQuery() Write-host -f Green "'$($WorkflowAssociations | where {$_.ID -eq $WorkflowInstance.WorkflowSubscriptionId} | Select -ExpandProperty Name)'is Terminated"4KViews0likes0CommentsRe: Add a line to skip or continue loop execution
VasilMichev using LainRobertson code, what will be my code with continue command. Is it something like that? { if (Read-Host -Prompt "Do you want to Terminate this instance:" -in @("n", "no")) { Continue } $Ctx.ExecuteQuery() ; Write-host -f Green "'$($WorkflowAssociations | Where-Object {$_.ID -eq $WorkflowInstance.WorkflowSubscriptionId} | Select-Object -ExpandProperty Name)'is Terminated"; return; }4KViews0likes0Comments
Recent Blog Articles
No content to show