November Happy Hour will be moved to Thursday December 5th.

Trouble with ContentRepository.Save

Vote:
 

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?

Thanks
/Thomas

#120996
Apr 29, 2015 15:51
Vote:
 

Hi,

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: http://world.episerver.com/documentation/items/tech-notes/episerver-cms-6/episerver-cms-60/event-management-system-specification/

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.

Regards.

/Q

#121030
Apr 30, 2015 2:22
Vote:
 

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.

/T

#121487
May 12, 2015 12:15
Vote:
 

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

#298703
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.