Joined: 2/2/2010 Posts: 2
|
I am using Ektron version 7.5.3.11 and attempting to add content to a folder through the API. I am able to use the AddContent method that accepts a content id and language id to add additional language versions of normal content items, but I am not able to do it for smart form based items. The version of AddContent that supports the xml configuration ID does not provide a way to specify the content ID so I am unable to add language versions of content with it.
Is there a way to add new language versions to smart form content through the API?
thanks
-Zac
|
Joined: 2/2/2010 Posts: 2
|
Well, I answered my own question. I have not found a way to do it through the recommended 'public' api, but I was able to get it to work by using code derived from the workarea code. This requires the user to be logged into ektron, but that allows the code to put the correct 'last edited by' instead of always saying it is internal administrator.
The trick is to use the Ektron.Cms.ContentAPI class, rather than the Ektron.Cms.Api.Content.Content class. It has two important methods: AddNewContentv2_0 and SaveContentV2_0. Both take a Microsoft.VisualBasic.Collection object which holds all of the parameters.
To add a localized version of smart form data to an existing content item, you can pass a collection that contains the following keys:
"ContentType"
"ContentHtml"
"LockedContentLink"
"Comment"
"ContentID" // this is the key to adding new langs to existing content. You can get PK violations here if the content already exists
"ContentLanguage"
"ContentMatadata"//I don't know what is supposed to go in here
"ContentTeaser"
"FolderID"
"SearchText"
"GoLive"
"EndDate"
"AssetID"
"AssetVersion"
"AssetFilename"
"MimeType"
"FileExtension"
"MimeName"
"ImageUrl"
"MediaAsset"
"ContentTitle"
"ManualAlias"
"ManualAliasID"
"Taxonomy"
"Image"
"MultiXmlID" // this is the smart form configuration ID
"MultiTemplateID"
"AddToQlink"
"IsSearchable"
some of the params could probably be skipped for normal content, stuff like the Asset data. Note that I didn't do anything with metadata - that's a whole other basket of issues. I don't know what the minimum set of data is, or if the order matters (I doubt it) but if you build a collection with those keys and fill in the data you want, you can do this. After you fill the collection, call
contentApi.AddNewContentv2_0(YOURCOLLECTIONNAME)
contentApi.CheckContentInv2_0(contentId,"");
Remember that the current contentApi.ContentLanguage is what will be used to save the content, so you have to change that first to be the new language ID before ou call AddNewContent or CheckContentIn.
|