Hi All,
Why this error occur in SharePoint? Someone has any idea?
please provide me solution on it?
{
string filename = strDownloadFileOnLocalMachine + strtempSSRNXMLNewDocument + ".xml";
string xmlFileNameWithoutExtension = Path.GetFileNameWithoutExtension(strhtmlfileName);
FileStream fstream = File.OpenRead(filename);
byte[] htmlcontent = new byte[fstream.Length];
fstream.Read(htmlcontent, 0, (int)fstream.Length);
fstream.Close();
Hashtable metadatXML = new Hashtable();
metadatXML.Add("File Title", strGoldContentId);
metadatXML.Add("Converted Content Name", xmlFileNameWithoutExtension + ".xml");
metadatXML.Add("Content Name", strGoldLibraryContentId);
metadatXML.Add("vti_title", strGoldLibraryTitle);
properties.Web.AllowUnsafeUpdates = true;
SPDocumentLibrary documentLibrary = (SPDocumentLibrary)properties.Web.Lists[strListConvertedContentLibrary];
SPFileCollection htmlfiles = documentLibrary.RootFolder.Files;
SPFile newXMLFile = htmlfiles.Add(documentLibrary.RootFolder.Url + "/" + xmlFileNameWithoutExtension + ".xml", htmlcontent, metadatXML, true);
newXMLFile.Update();
properties.Web.AllowUnsafeUpdates = false;
}
by using above code i have uploaded xml file to SharePoint Document library.
That time it throws Exception like
Microsoft.SharePoint.SPException ---> System.Runtime.InteropServices.COMException: 0x8102009b
at Microsoft.SharePoint.Library.SPRequestInternalClass.AddWorkflowToListItem(String bstrUrl, String bstrListName, Int32 lItemID, Int32 lItemLevel, Int32 lItemVersion, Guid workflowPackageId, Guid& pWorkflowInstanceId, Guid workflowTaskListId, String bstrStatusFieldInternalName, Int32 lAuthorId, String bstrModificationXml, Guid correlationId)
at Microsoft.SharePoint.Library.SPRequest.AddWorkflowToListItem(String bstrUrl, String bstrListName, Int32 lItemID, Int32 lItemLevel, Int32 lItemVersion, Guid workflowPackageId, Guid& pWorkflowInstanceId, Guid workflowTaskListId, String bstrStatusFieldInternalName, Int32 lAuthorId, String bstrModificationXml, Guid correlationId)
--- End of inner exception stack trace ---
at Microsoft.SharePoint.Workflow.SPWinOeEngine.CreateWorkflow(Object context, SPWorkflowAssociation association, SPWorkflowEvent startEvent, Boolean bCreateOnly)
at Microsoft.SharePoint.Workflow.SPWorkflowManager.StartWorkflowElev(Object context, SPWorkflowAssociation association, DateTime elevationTimeUtc, SPWorkflowEvent startEvent, SPWorkflowRunOptions runOptions)
at Microsoft.SharePoint.Workflow.SPWorkflowManager.<>c__DisplayClass16.b__15(SPSite superUserSite, SPWeb superUserWeb)
at Microsoft.SharePoint.SPSecurity.<>c__DisplayClassd.b__b()
at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass5.b__3()
at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
at Microsoft.SharePoint.Workflow.SPWorkflowManager.StartWorkflow(Object context, SPWorkflowAssociation association, SPWorkflowEvent startEvent, SPWorkflowRunOptions runOpt
Thanks, Samadhan