Click here to Skip to main content
15,902,299 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

Why this error occur in SharePoint? Someone has any idea?
please provide me solution on it?

C#
{
//getting xml file name from local path
string filename = strDownloadFileOnLocalMachine + strtempSSRNXMLNewDocument + ".xml";
//	string filename = NewXMLFile;

//getting html file name without extension
string xmlFileNameWithoutExtension = Path.GetFileNameWithoutExtension(strhtmlfileName);
//creating file stream object to read content from the specified path
FileStream fstream = File.OpenRead(filename);
//reading content to byte array
byte[] htmlcontent = new byte[fstream.Length];
//reading file stream
fstream.Read(htmlcontent, 0, (int)fstream.Length);
//closing file stream
fstream.Close();
//defining hashtable for metadataXml
Hashtable metadatXML = new Hashtable();
//adding metadata values in metadataHtml hashtable
metadatXML.Add("File Title", strGoldContentId);
metadatXML.Add("Converted Content Name", xmlFileNameWithoutExtension + ".xml");
metadatXML.Add("Content Name", strGoldLibraryContentId);
metadatXML.Add("vti_title", strGoldLibraryTitle);
 
//enabling sharepoint list changes
properties.Web.AllowUnsafeUpdates = true;
//referencing 'converted content library'
SPDocumentLibrary documentLibrary = (SPDocumentLibrary)properties.Web.Lists[strListConvertedContentLibrary];
//getting 'converted content library' file collection
SPFileCollection htmlfiles = documentLibrary.RootFolder.Files;
//adding converted content to 'converted content library'
SPFile newXMLFile = htmlfiles.Add(documentLibrary.RootFolder.Url + "/" + xmlFileNameWithoutExtension + ".xml", htmlcontent, metadatXML, true);
 
newXMLFile.Update();
//disabling sharepoint list changes
properties.Web.AllowUnsafeUpdates = false;

}

by using above code i have uploaded xml file to SharePoint Document library.
That time it throws Exception like
C#
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
Posted
Updated 26-Nov-14 3:11am
v3
Comments
Thanks7872 26-Nov-14 8:46am    
We can not read your mind. Without showing your code, how do you expect help from anyone?
Thanks7872 26-Nov-14 9:05am    
Don't you see improve question link at bottom of the question? Use it. Dont post code here.
samadhan_kshirsagar 26-Nov-14 9:21am    
ok ,Rohan from next onward I will never paste code here.

Any idea on it. Why this error has occur?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900