cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

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
Highlighted
Super User III
Super User III

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!

Learn more from my blog

View solution in original post

19 REPLIES 19
Highlighted
Super User III
Super User III

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!

Learn more from my blog
Highlighted
Helper II
Helper II

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

Highlighted
Super User III
Super User III

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!

Learn more from my blog
Highlighted
Helper II
Helper II

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

Highlighted
Super User III
Super User III

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!

Learn more from my blog
Highlighted
Helper II
Helper II

Re: SharePoint to CosmosDB

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

Highlighted
Super User III
Super User III

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!

Learn more from my blog
Highlighted
Helper II
Helper II

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

Highlighted
Super User III
Super User III

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!

Learn more from my blog
Highlighted
Helper II
Helper II

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; }
Highlighted
Super User III
Super User III

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!

Learn more from my blog
Highlighted
Helper II
Helper II

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

Highlighted
Super User III
Super User III

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!

Learn more from my blog

View solution in original post

Highlighted
Helper II
Helper II

Re: SharePoint to CosmosDB

Great that worked!  Thank you @abm 

Highlighted
Super User III
Super User III

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!

Learn more from my blog
Highlighted
Frequent Visitor

Re: SharePoint to CosmosDB

@abm @wnguyen23 

 

guys, I am stuck with same error message and when i am trying to add initialize variable step after Json parse, I get the error as initialize variable can only be used at the beginning of the step. Its not allowing me to add the step. can you please guide me as how you did.

My Parse Json response is something like this:
[
{
"Id": "ABCAnalysis_v4.2.1|VIBGYg_pious_UX|GOORag_2.1.1.1_1S20TYSS9878_20200930dj878",
"DocType": "SIM",
"Project": "TEST_Project",
"ProjectId": "TESTGOOD_2.1.1.1_1S20QJHJSSSKS345678_202009980T083330Z",
"Tags": [],
"Properties": {},
"Categories": [],
"Trigger": true,
"Received": "2020-10-02T06:21:09.3296729Z"
},
{
"Id": "ABCAnalysis_v4.2.1|VIBGYg_pious_UX|GOORag_2.1.1.1_1S20TYSS9878_20200930dj878",
"DocType": "SIM",
"Project": "TEST_Project",
"ProjectId": "TESTGOOD_2.1.1.1_1S20QJHJSSSKS345678_202009980T083330Z",
"Tags": [],
"Properties": {},
"Categories": [],
"Trigger": true,
"Received": "2020-10-02T06:21:09.329692Z"
}

 

and here is my flow design. objective is to copy the response in cosmos db. trying to add initialize variable step between parse json and create and update document.

sb4.PNG

 

 

 

 

 

Highlighted
Super User III
Super User III

Re: SharePoint to CosmosDB

Hi @Ankit77 

 

Declare the initialise variable outside the loop. Then inside the variable use the set variable action step to set the value. You can't initialise the variable inside the loop.

 

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!

Learn more from my blog
Highlighted
Frequent Visitor

Re: SharePoint to CosmosDB

hi @abm 

 

Thanks for response but still I am unable to figure out. maybe the case is bit different, though my error and objective is same as this post. My input is coming from Service bus topic and I am actually decodingBase64 "ContentData" to get my Json. So I have initialized the variables before doing this decoding.

 

Here how it looks, now when I am setting variable, I am either setting it in wrong way from dynamic expression or maybe the initialization variable is wrong. here is the screen shot after i run the flow and in edit mode:

 

Flow response after run:

 

Ankit77_0-1601632695762.png

 

screen shot 2:

 

Ankit77_1-1601632841641.png

 

 

Flow in Edit mode:

Ankit77_2-1601632968018.png

 ** ignore the condition branch

 

Any clue what is wrong here, why am i getting null values for all

 

Highlighted
Super User III
Super User III

Re: SharePoint to CosmosDB

Hi @Ankit77 

 

Thanks for the screen share. Hope you progressed to next level. If you still need some help please create a new thread and let me know.

 

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!

Learn more from my blog

Helpful resources

Announcements
Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Top Solution Authors
Top Kudoed Authors
Users online (5,670)