question

JonesDarren-7557 avatar image
0 Votes"
JonesDarren-7557 asked RaytheonXie-MSFT commented

Exception calling "ExecuteQuery" with "0" argument(s): "The object specified does not belong to a list

Hi,
I am trying to create some document set in SP online but getting the following error

Exception calling "ExecuteQuery" with "0" argument(s): "The object specified does not belong to a list."
At C:\DMS\DMSDocSetImport.ps1:31 char:2
+ $spoCtx.ExecuteQuery()

The script I am using:

202901-image.png

Any help appreciated.

office-sharepoint-onlinepower-query-not-supported
image.png (145.4 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

RaytheonXie-MSFT avatar image
0 Votes"
RaytheonXie-MSFT answered RaytheonXie-MSFT commented

Hi @JonesDarren-7557 ,
The object specified does not belong to a list means that SharePoint attempt to get an Item(Specified by strUrl) that does not belong to the SPWeb.

If you did not set some url correctly, this error may occur. Please check this link for more information.
https://stackoverflow.com/questions/39413728/the-object-specified-does-not-belong-to-a-list-error-using-csom

In your case, I guess the $CurrentDocSet or $spoDocumentSet didn't get the correct value. You can try to check the value of them or provide us with text documentation of the code so that we can test about the issue.



If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.




· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @JonesDarren-7557 ,
Would you tell me whether your issue has been resolved or have any update?
I am looking forward to your reply.

Have a nice day!

Thanks,
Raytheon Xie

0 Votes 0 ·

Hi Raythee,
I don't believe it's a URL issue as the script is creating the document sets in the list and setting the name field. The issue is it's not setting any of the properties

0 Votes 0 ·

Hi @JonesDarren-7557 ,
Could you provide us the csv file and the txt code for us to test further?



0 Votes 0 ·