Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Programmatically Change Document MetaData

  Asked By: Abhishek    Date: Nov 20    Category: Sharepoint    Views: 2485

This is what I am trying to Do:
dim oDoc as new PKMCDO.KnowledgeDocument
dim oConn as new ADODB.Connection


oDoc.DataSource.Open "http://spsserver/workspace/enhancedfolder/t.doc
oDoc.ContentClass = "urn:content-classes:temp"
oDoc.DataSource.Save '<== this when my error happens.

when I try to save the modified property i get a username & password
dialogue box and when I enter my Coordinator Username & password I
end up getting a permission denied Error. Now I have tried Rebooting
the server, I have tried programmatically checking out the document
first.

Curious thing is that this process works on non-enhanced folders.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Sanjay Lohar     Answered On: Nov 20

This is Tim in regards to your
response to message 4 of your post today.

Yes I have the closing quote, and I have most definitely already
tried opening the file in admodereadwrite. If it were that trivial a
problem I wouldn't have posted. I will include here all the actual
code I am trying (which works  in a non-enhanced folder...)

Set objDoc = New PKMCDO.KnowledgeDocument
objDoc.PromptToAuthenticate = False
objDoc.DataSource.Open rs.Fields(2).Value, oConn,
adModeReadWrite
objDoc.ContentClass = "urn:content-classes:" &
txtContentClass.Text
objDoc.DataSource.Save

(THIS WORKS IN A NON ENHANCED FOLDER BUT WHEN I TRY IN AN ENHANCED
FOLDER, THATS WHEN IT PROMPTS FOR A NETWORK PASSWORD AND NOTHING
WORKS)

 
Answer #2    Answered By: Mason Salazar     Answered On: Nov 20

Sorry, I normally don't even bother reading the list as there seem to be a lot
of problems of that sort. : )

I'm at a bit of a loss. Where is this code running? In a web-part, or a script?
Who's running it (permissions)? Is everything on the same server?

You may wish to try getting a handle to the latest version of the document, and
modifying that rather than the base version:

'open doc
oDocument.DataSource.Open strDocumentURL

'bind a rs to the document's version status (create a KnowledgeVersion first. .
.)
oRs = oVersion.VersionStatus(oDocument)

'rebind
oDocument.DataSource.Open oRs("DAV:href"), , adModeReadWrite

'set content-class
'save as normal

Hope that helps. I'm not sure exactly what the mechanism is for how all of this
works. I've had nothing but headaches with undefined errors, bizarre ways of
accomplishing tasks, etc. In the end, trial-and-error seems to win though.

 
Didn't find what you were looking for? Find more on Programmatically Change Document MetaData Or get search suggestion and latest updates.