Problems With Uploading a document using PKMCDO.KnowledgeDocument



Hello there,
I am in a bit of a dilema at the moment. I am using the folllowing code to
upload a file to a sharepoint document library. The only problem is that I
always get the "The parameter is incorrect." (code -2147024809 ) error when
doing the oDoc.DataSource.SaveTo


Function CreateDocument(sFilestream, sHref, sCC) As PKMCDO.KnowledgeDocument

Dim oDoc As PKMCDO.KnowledgeDocument

Dim oStream As ADODB.Stream
Dim nIndex As Integer
Dim sPropName As String

Set oDoc = CreateObject("CDO.KnowledgeDocument")

Set oStream = oDoc.OpenStream
oStream.Type = adTypeBinary
oStream.SetEOS
oStream.LoadFromFile sFilestream
oStream.Flush

oDoc.ContentClass = sCC ' "urn:content-classes:basedocument"
End If

Call oDoc.DataSource.SaveTo(sHref, , ,
RecordCreateOptionsEnum.adCreateOverwrite)

Set CreateDocument = oDoc

End Function

does anybody have any idea on what might be causing this. I know that the
url and local file are correct as I can go into sharepoint and see the
document, but it has no data.

Many thanks.

Gary


.



Relevant Pages

  • Re: Mail Merge - Office 2003
    ... In the Outlook VBA only a reference to Outlook is set automatically. ... odoc As word.document) As Boolean ... Dim oOutlook As Outlook.Application ... Set oWord = GetObjectIf oWord Is Nothing Then ...
    (microsoft.public.outlook.program_vba)
  • Re: Range Madness and Other Frustrations
    ... Sub OnExitDropDown() ... Dim oDoc As Document ... Dim oTmpl As Template ... select back to the original bookmark. ...
    (microsoft.public.word.vba.general)
  • Mail Merge - Office 2003
    ... Private Function fillbookmark(sBookmark As String, sValue As String, _ ... odoc As word.document) As Boolean ... Dim oOutlook As Outlook.Application ... On Error GoTo WordBookmarkError ...
    (microsoft.public.outlook.program_vba)
  • Mail Merge - Office 2003
    ... Private Function fillbookmark(sBookmark As String, sValue As String, _ ... odoc As word.document) As Boolean ... Dim oOutlook As Outlook.Application ... On Error GoTo WordBookmarkError ...
    (microsoft.public.outlook.program_vba)
  • Re: Update Graph via VBA - Changes Not Saved
    ... If I have interpreted the code correctly, the graph is in oDoc and you are ... Dim oMSGraphWrapper As Word.InlineShape ... Set oMSGraphWrapper = Selection.InlineShapes ... Dim intA As Integer, intB As Integer ...
    (microsoft.public.word.vba.general)