Add-SPOSiteDesignTask : Operation is not valid due to the current state of the object.

%3CLINGO-SUB%20id%3D%22lingo-sub-1186151%22%20slang%3D%22en-US%22%3EAdd-SPOSiteDesignTask%20%3A%20Operation%20is%20not%20valid%20due%20to%20the%20current%20state%20of%20the%20object.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1186151%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20created%20site%20design%20with%20two%20site%20scripts.%20applied%20using%20below%20command%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%233366FF%22%3E%24Sitedesignout1%3DAdd-SPOSiteDesign%20-Title%20%22Site%20Design%202%22%20-WebTemplate%20%2268%22%20-SiteScripts%20%24result1.Id%2C%24result2.Id%20-Description%20%22Site%20Desin%20Sample%22%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20after%20try%20to%20apply%20Site%20design%20using%20below%20code%20throwing%20an%20Operation%20is%20not%20valid%20due%20to%20the%20current%20state%20of%20the%20object%20error%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%233366FF%22%3E%24adminSiteUrl%20%3D%20%22%3CA%20href%3D%22https%3A%2F%2Fmyadmin-admin.sharepoint.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmyadmin-admin.sharepoint.com%3C%2FA%3E%22%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%233366FF%22%3E%24siteUrl%20%3D%20%22https%3A%2F%2F%20myadmin.sharepoint.com%2Fsites%2FPracticeSiteDesign%22%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%233366FF%22%3E%24siteDesignId%20%3D%20%2204d0e647-5912-4ef7-8069-9186cebb2192%22%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%233366FF%22%3EConnect-SPOService%20%24adminSiteUrl%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%233366FF%22%3E%24task%20%3D%20Add-SPOSiteDesignTask%20-SiteDesignId%20%24siteDesignId%20-WebUrl%20%24siteUrl%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%233366FF%22%3EAdd-SPOSiteDesignTask%20%3A%20Operation%20is%20not%20valid%20due%20to%20the%20current%20state%20of%20the%20object.%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%233366FF%22%3EAt%20line%3A6%20char%3A9%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%233366FF%22%3E%2B%20%24task%20%3D%20Add-SPOSiteDesignTask%20-SiteDesignId%20%24siteDesignId%20-WebUrl%20%24si%20...%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%233366FF%22%3E%2B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%233366FF%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2B%20CategoryInfo%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3A%20NotSpecified%3A%20(%3A)%20%5BAdd-SPOSiteDesignTask%5D%2C%20ServerException%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%233366FF%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2B%20FullyQualifiedErrorId%20%3A%20Microsoft.SharePoint.Client.ServerException%2CMicrosoft.Online.SharePoint.PowerShell.AddSPOSiteDesignTask%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1186151%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%20Powershell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Occasional Contributor

I have created site design with two site scripts. applied using below command

$Sitedesignout1=Add-SPOSiteDesign -Title "Site Design 2" -WebTemplate "68" -SiteScripts $result1.Id,$result2.Id -Description "Site Desin Sample"

 

But after try to apply Site design using below code throwing an Operation is not valid due to the current state of the object error

 

$adminSiteUrl = "https://myadmin-admin.sharepoint.com"

$siteUrl = "https:// myadmin.sharepoint.com/sites/PracticeSiteDesign"

$siteDesignId = "04d0e647-5912-4ef7-8069-9186cebb2192"

 

Connect-SPOService $adminSiteUrl

$task = Add-SPOSiteDesignTask -SiteDesignId $siteDesignId -WebUrl $siteUrl

Add-SPOSiteDesignTask : Operation is not valid due to the current state of the object.

At line:6 char:9

+ $task = Add-SPOSiteDesignTask -SiteDesignId $siteDesignId -WebUrl $si ...

+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Add-SPOSiteDesignTask], ServerException

    + FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerException,Microsoft.Online.SharePoint.PowerShell.AddSPOSiteDesignTask

 

0 Replies