As part of my use-case I am looking for a mapping where I can save my Key and GUID pair of a Dictionary to Tridion.ContentManager.ApplicationData
in an ECL Provider.
using (IEclSession eclSession = SessionFactory.CreateEclSession(engine.GetSession()))
{
}
Since ECL is an external application, in above code SessionFactory.CreateEclSession(engine.GetSession())
does not seem to work. refer this
I have tried below code, But does not seem to work, see comments in code inline.
// Creating GUID;
Guid guid = Guid.NewGuid();
//I know this won't work, How can we get a session?
Session session = new Session();
var TcmId = "tcm:0-" + eclUri.PublicationId + "-1"; //tcm:0-2-1
var pubTcmId = new TcmUri(TcmId);
// Throws error as it aspects some configuration
Publication pub = new Publication(session);
IdentifiableObject pubItem = pub.GetObject(pubTcmId);
Dictionary<string, string> IdSet = new Dictionary<string, string>();
s3IdSet.Add(directory.FullName, guid.ToString());
//Tridion.ContentManager.ApplicationData - Key and value pair
ApplicationData appData = new ApplicationData(IdSet.ToString());
identification = appData.ApplicationId;
pubItem.SaveApplicationData(appData);
Any help would be much appreciated?