Home

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

%3CLINGO-SUB%20id%3D%22lingo-sub-1186139%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-1186139%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%24adminSiteUrl%20%3D%20%22%3CA%20href%3D%22https%3A%2F%2Fmyadmin-admin.sharepoint.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmyadmin-admin.sharepoint.com%3C%2FA%3E%22%3C%2FP%3E%3CP%3E%24siteUrl%20%3D%20%22https%3A%2F%2F%20myadmin.sharepoint.com%2Fsites%2FPracticeSiteDesign%22%3C%2FP%3E%3CP%3E%24siteDesignId%20%3D%20%2204d0e647-5912-4ef7-8069-9186cebb2192%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EConnect-SPOService%20%24adminSiteUrl%3C%2FP%3E%3CP%3E%24task%20%3D%20Add-SPOSiteDesignTask%20-SiteDesignId%20%24siteDesignId%20-WebUrl%20%24siteUrl%3C%2FP%3E%3CP%3EAdd-SPOSiteDesignTask%20%3A%20Operation%20is%20not%20valid%20due%20to%20the%20current%20state%20of%20the%20object.%3C%2FP%3E%3CP%3EAt%20line%3A6%20char%3A9%3C%2FP%3E%3CP%3E%2B%20%24task%20%3D%20Add-SPOSiteDesignTask%20-SiteDesignId%20%24siteDesignId%20-WebUrl%20%24si%20...%3C%2FP%3E%3CP%3E%2B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3C%2FP%3E%3CP%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%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2B%20FullyQualifiedErrorId%20%3A%20Microsoft.SharePoint.Client.ServerException%2CMicrosoft.Online.SharePoint.PowerShell.AddSPOSiteDesignTask%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1186139%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1187488%22%20slang%3D%22en-US%22%3ERe%3A%20Add-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-1187488%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F208605%22%20target%3D%22_blank%22%3E%40Dinesh%20Bhat%3C%2FA%3E%26nbsp%3BI've%20historically%20encountered%20this%20same%20error%2C%20albeit%20not%20with%20the%20SPOSiteDesignTask%20cmdlet.%20Have%20you%20ensured%20that%20the%20site%20that%20you're%20trying%20to%20interact%20with%20is%20not%20being%20edited%20by%20anybody%20else%20at%20the%20time%20that%20the%20command%20is%20running%2C%20and%20that%20any%20pending%20changes%20have%20been%20published%3F%20Have%20you%20also%20encountered%20this%20same%20issue%20with%20different%20site%20designs%2C%20or%20is%20it%20only%20this%20site%20design%20which%20has%20been%20presenting%20issues%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20this%20helps!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1188123%22%20slang%3D%22en-US%22%3ERe%3A%20Add-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-1188123%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F441017%22%20target%3D%22_blank%22%3E%40rowanhucklebridge%3C%2FA%3E%26nbsp%3B%2C%20Thanks%20for%20the%20reply.%20I%20have%20created%20new%20site%20without%20any%20additional%20content.%20So%20there%20is%20no%20pending%20changes%20and%20I%20am%20the%20only%20person%20having%20access%20to%20the%20site.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eif%20I%20create%20site%20design%20for%20each%20site%20script%20its%20working%20good.%20But%20only%20problem%20I%20need%20register%20multiple%20site%20design%20to%20tenant.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Eif%20I%20combine%20site%20script%20and%20registered%20as%20one%20site%20design%2C%20throwing%20below%20error.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20share%20your%20thought%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1190243%22%20slang%3D%22en-US%22%3ERe%3A%20Add-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-1190243%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F208605%22%20target%3D%22_blank%22%3E%40Dinesh%20Bhat%3C%2FA%3E%26nbsp%3BI'm%20not%20sure%20how%20much%20help%20I%20can%20be%20here.%20Whenever%20I've%20previously%20received%20the%20same%20error%20message%20that%20you've%20been%20receiving%20-%20%22Operation%20is%20not%20valid%20due%20of%20the%20current%20state%20of%20the%20object%22%20-%20it%20usually%20means%20that%20whatever%20I%20am%20attempting%20to%20edit%20or%20modify%20cannot%20currently%20be%20modified%2C%20for%20instance%20if%20it%20is%20already%20undergoing%20edits%20or%20changes.%20So%20whilst%20I%20don't%20think%20I'm%20able%20to%20suggest%20a%20fix%20for%20you%2C%20I%20might%20be%20able%20to%20help%20diagnose%20where%20things%20are%20going%20wrong.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20this%20end%2C%20do%20you%20have%20multiple%20site%20scripts%20interact%20with%20the%20same%20sections%2Ffunctions%2Fareas%3F%20Could%20this%20be%20where%20the%20issue%20is%20coming%20from%3F%3C%2FP%3E%3C%2FLINGO-BODY%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

 

3 Replies
Highlighted

@Dinesh Bhat I've historically encountered this same error, albeit not with the SPOSiteDesignTask cmdlet. Have you ensured that the site that you're trying to interact with is not being edited by anybody else at the time that the command is running, and that any pending changes have been published? Have you also encountered this same issue with different site designs, or is it only this site design which has been presenting issues?

 

Hope this helps!

Highlighted

@rowanhucklebridge , Thanks for the reply. I have created new site without any additional content. So there is no pending changes and I am the only person having access to the site. 

 

if I create site design for each site script its working good. But only problem I need register multiple site design to tenant.

 

if I combine site script and registered as one site design, throwing below error.

 

Please share your thought 

 

 

Highlighted

@Dinesh Bhat I'm not sure how much help I can be here. Whenever I've previously received the same error message that you've been receiving - "Operation is not valid due of the current state of the object" - it usually means that whatever I am attempting to edit or modify cannot currently be modified, for instance if it is already undergoing edits or changes. So whilst I don't think I'm able to suggest a fix for you, I might be able to help diagnose where things are going wrong.

 

To this end, do you have multiple site scripts interact with the same sections/functions/areas? Could this be where the issue is coming from?