cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
wnguyen23
Level: Powered On

SharePoint to CosmosDB

Hello,

 

I need some assistance here, I can't seem to figure out the partition key error here, I've looked at a few articles online.  I've attached some screenshots.  I even tried typing in "2186" by itself.

 

Thank you,

 

William

 

1.PNG2.PNG3.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: SharePoint to CosmosDB

Hi @wnguyen23 ,

 

Thanks for your reply.

 

What you could do is use your intial json results pass it to flow step 'Parse Json'. 

 

Next step use something like this using your json parsed values.

 

j1.png

 

Try the above and see how it goes.

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



View solution in original post

15 REPLIES 15
Super User
Super User

Re: SharePoint to CosmosDB

Hi @wnguyen23 ,

 

Did you come across this article?

 

https://marcelzehner.ch/2019/02/05/issues-with-creating-new-cosmos-db-documents-with-logic-app/

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



wnguyen23
Level: Powered On

Re: SharePoint to CosmosDB

@abm 

 

Hi,

 

I did come across it and tried the solutions on there.  What does it look like I am doing wrong?

 

Thank you,

 

William

Super User
Super User

Re: SharePoint to CosmosDB

Hi @wnguyen23 ,

 

Thanks for your quick reply.

 

Did you tried without the double quotes? Just enter 2186.

 

Also try changing the database partition key from Id to to some other property.  Change the flow step to configure the new property and try.

 

Currently I don't have a setup in my environemnt to access COSMOSDB.

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



wnguyen23
Level: Powered On

Re: SharePoint to CosmosDB

Yup I tried it all.  @abm  

Tried switching the key as well.

 

"The input content is invalid because the required properties - 'id; ' - are missing\"

- using "0x0100982F8AF3A6F53249B3C8E645C53D1035"

 

Partition key [0x0100982F8AF3A6F53249B3C8E645C53D1035] is invalid.

- using 0x0100982F8AF3A6F53249B3C8E645C53D1035

 

Partition key [x-ms-documentdb-partitionkey:[\"0x0100982F8AF3A6F53249B3C8E645C53D1035x\"]] is invalid.

-using x-ms-documentdb-paritionkey:["0x0100982F8AF3A6F53249B3C8E645C53D1035"]

Untitled.png

Super User
Super User

Re: SharePoint to CosmosDB

Hi @wnguyen23 ,

 

Thanks for your reply.

 

Looks like your "Id" is treating as another property. It is case sensitive. Try changing the "Id" to "id"

 

https://stackoverflow.com/questions/29725561/documentdb-replacedocument-fails

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



wnguyen23
Level: Powered On

Re: SharePoint to CosmosDB

I tried changing the partiton key and it seems to still have the same problem. @abm 

Super User
Super User

Re: SharePoint to CosmosDB

Hi @wnguyen23 ,

 

Thanks for your reply.

 

You must ensure the id is populated in the body of the document you are replacing. Did you tried with small "id"?  Believe this is the primary key?

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



wnguyen23
Level: Powered On

Re: SharePoint to CosmosDB

Does it have anything to do with the way the data is coming in/formatted?  My document and the example on the right seems to be differerent.  @abm Untitled.png

Super User
Super User

Re: SharePoint to CosmosDB

Hi @wnguyen23 ,

 

It's worth trying the order "id" as the first element.

 

https://docs.microsoft.com/en-us/azure/cosmos-db/sql-query-getting-started

 

Also you could try using a flow JSON parser step and hardcode a sample json file and try processing it.

 

Let me know how it goes.

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

Thanks

 

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



wnguyen23
Level: Powered On

Re: SharePoint to CosmosDB

@abm 

I believe it has to do with me having "Id".  I've tried to rename it in SharePoint to "id" and it is still reading it as "Id".

 

The input content is invalid because the required properties - 'id; ' - are missing.
Is there a way to convert the Id to id in JSON?
 
I've read to try something like this but not sure how.
 
[JsonProperty(PropertyName = "id")]
public Guid Id { get; set; }
Super User
Super User

Re: SharePoint to CosmosDB

Hi @wnguyen23 ,

 

It could be the issue. The sample code is for C# development not for flow. 

 

You could try replacing the JSON Id to id using a replace function. 

 

To achieve this try pushing the JSON results to a string variable. Then use the replace expression to change the Id.

 

Thanks

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



wnguyen23
Level: Powered On

Re: SharePoint to CosmosDB

It looks like the data has to come in exactly like this, the JSON data I am importing has a bunch of other garbage.  Is there a way to format the data to come in looking like below?

@abm 

1.PNG

Super User
Super User

Re: SharePoint to CosmosDB

Hi @wnguyen23 ,

 

Thanks for your reply.

 

What you could do is use your intial json results pass it to flow step 'Parse Json'. 

 

Next step use something like this using your json parsed values.

 

j1.png

 

Try the above and see how it goes.

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



View solution in original post

wnguyen23
Level: Powered On

Re: SharePoint to CosmosDB

Great that worked!  Thank you @abm 

Super User
Super User

Re: SharePoint to CosmosDB

Hi @wnguyen23 ,

 

Fantastic news.

 

Glad to hear that it worked. 

 

All the best.

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!



Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,497)