Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need script to automatically publish a document

Status
Not open for further replies.

ChrisOjeda

Programmer
Apr 16, 2003
45
0
0
US
Hi,

I'd like to run a VBA script in Access to automatically publish a document. Does anyone have a script?
 
Can someone please give me some direction on this matter?
 
Through my travels I came across this incredible code that someone has developed that harnesses Event Sinks in Exchange Type stores (web storage systems like Sharepoint). It waits for the Event to occur, such as a document being put into a web folder and then it takes the document and automatically publishes it! Wow! It can be found here, I would read the information a few times to really get the gist of it and grasp the concept, that is what i had to do!
I know you were looking for a vbscript to run in Access but I thought this might be of some help or maybe you could borrow from it. Everything is done within Sharepoint and you modify the COM+ settings.

If I find something that is only Access related I will post it for you.

GMAN
 
Here's some vb script I wrote (just off the top of my head so check for errors) that will publish a document. Just call it with a URL to the document you want to publish. Save this code to a file (e.g. publish.vbs) or put it into your DashboardExtensions.vbs and use it in a webpart.

Example:
publish.vbs
Code:
'
' Given a URL to a document ([URL unfurl="true"]http://server/workspace/Documents/mydoc.doc)[/URL]
' publish a document. Assumes document is checked in.
'
Sub PublishDocument(urlDoc)

        Dim objDoc
        Dim objVersion

        Set objDoc = CreateObject("CDO.KnowledgeDocument")
        objDoc.DataSource.Open urlDoc

        Set objVersion = CreateObject("CDO.KnowledgeVersion")

        ' Publish the document
'       WScript.Echo "Publishing " & objDoc.Fields("RESOURCE_PARSENAME")
        objVersion.Publish objDoc

        ' Cleanup memory
        Set objDoc = Nothing
        Set objVersion = Nothing

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top