Not sure whether this should go here or in the sharepoint section.
Basically I want to create a web app that will allow the user to browse (using the input type="file") the local machine, select a document, click a button and the document selected gets published to our sharepoint server.
I've had a quick look around and found some code that is supposed to publish a document from a web app but I just cant seem to get it working.
Here's the code I'm running in the Page_Load:
If anyone could help that would be great.
Cheers
foz
Basically I want to create a web app that will allow the user to browse (using the input type="file") the local machine, select a document, click a button and the document selected gets published to our sharepoint server.
I've had a quick look around and found some code that is supposed to publish a document from a web app but I just cant seem to get it working.
Here's the code I'm running in the Page_Load:
Code:
PKMCDO.KnowledgeVersion docKnowVer = new PKMCDO.KnowledgeVersion();
PKMCDO._Stream docStream;
PKMCDO.KnowledgeDocument KnowDoc = new PKMCDO.KnowledgeDocument();
docStream = (PKMCDO._Stream)KnowDoc.OpenStream( (object) System.Type.Missing, PKMCDO.EnumKnowledge_StreamOpenSourceType.pkmOpenStreamUnspecified, null, PKMCDO.ConnectModeEnum.adModeUnknown,null,null);
docStream.SetEOS();
docStream.LoadFromFile(@"c:\testdoc2.txt");
docStream.Flush();
KnowDoc.Title = "My Title";
KnowDoc.Author = "mzamora";
KnowDoc.Description = "Your description";
KnowDoc.DataSource.SaveTo("[URL unfurl="true"]http://servername/workspace/documents/folder/",[/URL] null, PKMCDO.ConnectModeEnum.adModeReadWrite, PKMCDO.RecordCreateOptionsEnum.adCreateOverwrite, PKMCDO.RecordOpenOptionsEnum.adDelayFetchStream, @"domain\username", "password");
docKnowVer.Checkin(KnowDoc,0,"An XML Doc");
docKnowVer.Publish(KnowDoc,0);
If anyone could help that would be great.
Cheers
foz