I created document using office XML but now i m going to store that document in sharepoint library then it giving me an error like ["The Web application at {siteUrl} could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application."]
...Note that i have asp.net web application running on the same server where sharepoint running. I have added Microsoft.Sharepoint to my asp.net application but when i going to create the object of SPSite then it giving me this error.
Here is Code...
Using memStream As MemoryStream = New MemoryStream()
Using doc As WordprocessingDocument = WordprocessingDocument.Create(memStream, DocumentFormat.OpenXml.WordprocessingDocumentType.Document, True)
doc.AddMainDocumentPart()
doc.MainDocumentPart.Document = New Document(New Body(New Paragraph(New Run(New Text("Hello")))))
doc.MainDocumentPart.Document.Save()
End Using
Using Site As SPSite = New SPSite("http://sspl:5555/")
Dim docLib As SPList = Site.RootWeb.Lists("Doc")
Dim file As SPFile = docLib.RootFolder.Files.Add("Test.docx", memStream, True)
file.Update()
End Using
End Using
Your reply appreciated. Thanx