strong text [plugin error @ note entity][1]
[1]: http://i.stack.imgur.com/hrii9.png
hi,anyone resolved issue got plug-in error worked @ update of "note" entity.basically want plugin converted pre-exiting note attachment xml file new .mmp extension file same name. have done following procedure firstly created "converter_code.cs" dll contains convert() method converted xml file .mmp file here constructor of class.
public converter(string xml, string defaultmapfilename, bool isforweb) { xml = xml; defaultmapfilename = defaultmapfilename; result = environment.newline; isforweb = isforweb; ismapconverted = false; resultfolder = createresultfolder(mmcglobal.resultfolder); }
in convertplugin.cs plug-in class firstly retrieved note entity attachment xml file in string using following method in
ipluginexecutioncontext context =(ipluginexecutioncontext)serviceprovider. getservice (typeof(ipluginexecutioncontext)); iorganizationservicefactory servicefactory= (iorganizationservicefactory)serviceprovider.getservice(typeof(iorganizationservicefactory)); iorganizationservice service = servicefactory.createorganizationservice (context.userid); if (context.inputparameters.contains("target") && context.inputparameters["target"] entity) { // obtain target entity input parameters. entity entity = (entity)context.inputparameters["target"]; var annotationid = entity.getattributevalue<guid>("annotationid"); if (entity.logicalname != "annotation") { return; } else { try { //retrieve annotation file queryexpression notes = new queryexpression { entityname ="annotation" ,columnset = new columnset("filename", "subject", "annotationid", "documentbody") }; notes.criteria.addcondition("annotationid", conditionoperator.equal, annotationid); entitycollection notesretrieve = service.retrievemultiple(notes); if (notesretrieve != null && notesretrieve.entities.count > 0) { { //converting document body content bytes byte[] fill = convert.frombase64string(notesretrieve.entities[0] .attributes["documentbody"].tostring()); //converting string string content = system.text.encoding.utf8.getstring(fill); converter objconverter = new converter(content, "testmap", true); objconverter.convert(); } } } catch (faultexception<organizationservicefault> ex) { throw new invalidpluginexecutionexception("something going wrong"); } } } }
and string passed "converter" constructor parameter. merged dll using ilmerge following method: ilmerge /out:newconvertplugin.dll convertplugin.dll converter_code.dll
, newconvertplugin registered while working generate following error:
unexpected exception plug-in (execute): converterplugin.class1: system.security.securityexception: assembly not allow partially trusted callers. debug plugin using error-log not worked not reason whats going wrong.
the error caused library merged inside plugin.
first of using crm online (from screenshot) , crm online can use register plugins inside sandbox.
sandbox means plugins limited , run in partial-trust environment.
you merged external library requires full-trust permissions, plugin can't work , reason of error.
because in crm online, or find library (the converter) requires partial-trust, hoping merge process work, or include (if have it) source code of converter library directly inside plugin.
Comments
Post a Comment