PDA

View Full Version : Word VBA 2007: Need help getting started programming with SharePoint



avi10000
08-14-2011, 03:29 PM
Hi all,

I have had quite a lot of experience in programming in VBA, especially for Word - but so far no Sharepoint.

So now all of a sudden as part of a template design project with some VBA support programming, I may be required to write some code to save or updWord VBA 2007: Need help getting started programming with SharePoint
Hi all,

I have had quite a lot of experience in programming in VBA, especially for Word - but so far no Sharepoint.

So now all of a sudden as part of a template design project with some VBA support programming, I may be required to write some code to save or update documents in SharePoint and also update their version numbers.

So I need some pointers to help me get started programming with SharePoint

Does Word VBA support SharePoint?

What are the new objects? What methods perform the save and update? Do you need to supply an HTTP address for the SharePoint area? Or is it implicit? How do you open and save? Check in and check out? How do you get and set the version number?

Great thanks in advance.

-avraham

Frosty
08-15-2011, 08:01 AM
This is actually a lot trickier than you think, and you're going to need to talk to the sharepoint developers (whomever is doing that for you) in order to get the version numbers (and possible document numbers) the way you want them to be (if that's possible).

1. Yes, Word integrates very well with Sharepoint. They are both Microsoft products. You basically have the option of having your Sharepoint server look like any other networked drive folder. And the out-of-the-box integration (I'm told) is not terribly difficult.

2. Document number/version number is far trickier. It's entirely dependent on how your sharepoint site is going to be set up. But thinking of Sharepoint as a DMS the way FileSite/Hummingbird/etc (i.e., "managed" DMS) will lead to nothing but pain (at least, in my one experience with it and a law firm client).

Sharepoint is, conceptually, more akin to a wiki page-- it maintains all the versions of a document and allows you to access all of those versions, but it doesn't (out of the box) have some overlay feature which gives you a "document number" assigned from some central clearing station. It works just like Windows Explorer: name it whatever you want, as long as nothing else in that folder is named exactly the same. Create sub-folders how you want. Name them whatever you want. You can't have more than 1000 (or so) folders within another folder... but other than that, all the rules are basically the same as saving a folder into your My Documents folder. Except you get to leverage some more advanced searching on documents (and document content), as well as more robust backups, etc. All the reasons Sharepoint might be intriguing.

Depending on whether your documents are in Word 2003/earlier format or Word 2007 format, you will have different properties to look at, but the ContentTypeProperties collection is the place to start (if you're in 2007 format). Otherwise, I think some stuff will also get dumped into CustomDocumentProperties.

However... Document ID and Document Version (especially document version, since out of the box every time you check a document out, the Sharepoint server will, I believe, increment up a micro-version) is something to really investigate.

You could obviously automatically write a macro which checks to see what exists before automatically saving a document (i.e., folders/sub-folders/any existing documents, etc)... but that wasn't your original question. And that's an order of magnitude more difficult than simply checking to see what the document number is.

That has been my experience (not a positive one) with Sharepoint and the concept of document IDs and version numbers. Others will, I'm sure, have had different experiences.

avi10000
08-16-2011, 08:58 AM
Great! Thanks, Frosty. That's a great answer to start me off.

Actually, what happened was that it turned out that I wasn't required to program SharePoint - this time.

But I am sure it is going to hit me in the face one day soon. So this is a good opportunity now to gather information at my leisure and not under stress.

Thanks,
avraham