Try our conversational search powered by Generative AI!

Trouble with ContentRepository.Save


Hi guys

I'm creating some commerce content via a Api controller which is called from a third party system. I\m experiencing two problems:

1. When calling ContentRepository.Save(content, SaveAction.Publish, AccessLevel.NoAccess); I get an exception if I don't set the SecurityPrincipal manually first.

2. Even though SaveAction is set to publish, the content is not published. It's visible through the backend catalog browser but I have to publish the content manually.

I've tried pretty much everything.

Where can I try to debug this?


Apr 29, 2015 15:51


1) When you call ContentRepository.Save, it will use the current user name (via PrincipalInfo.Current) for SavedBy/ChangedBy information.

2) To make it appear in new Catalog UI, you must fire proper events so contents will be synched correctly.

From your post I assume you're using a separated application, while to make all thing right you'll need to run it in the context of Commerce site, or at least:

- Set the PrincipalInfo.Current to current user.

- Setup the event configuration, as mentioned here:

I would suggest to check your code in context of your site, such as a scheduled job to make sure everything run well before continue.



Apr 30, 2015 2:22

Hi Quan

Sorry for the late reply on this.

I appreciate your feedback - It turns out that I was looking at the wrong code. My bad.

Have a nice day.


May 12, 2015 12:15

What was the solution used here. I am facing the same problem.

Mar 21, 2023 13:34
Quan Mai - Mar 21, 2023 14:23
I suggest to create a new thread. this one is very old and was on an outdated version
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.