Sharepoint - OM or Web Services.

We need a command line tool which will interact with MOSS (Sharepoint 2007). Our developer has proposed two options, i.e. use Web Services or Object Model.

He has suggested that Web Services can work from remote machine, but for Object Model, we will have to run the code from same machine, where Sharepoint Server is running.

1. Which one is better? Object Model APIs or Web Services?2. In case we opt for Object Model APIs, and we must run the executable from Sharepoint server itself, how will that work in a Sharepoint Farm, where there are more than 1 physical servers?

Kevin
Wednesday, April 09, 2008

Deleting …Approving …

SP API is intended to use in custom developments of an SP site/portal (WebParts etc.) that become integral part of the application. I strongly advise not using it for external tools that need only comunicate with SP and not changing/adding functionality. All your reasons for not using the API above are valid and if the published functionality exposed by SP's web services fills your case go with it. In the rare case when your tool will need to do things not available as a web service I'd advise developing at API level as components for SP and exposing that functionality as a service too.

AZ
Thursday, April 10, 2008

Deleting …Approving …

There are some other possibilities depending on how deep you need to go with your integration. FrontPage RPC is one possibility if you need to send and retrieve documents. There are some other options also, some not documented so well.

I know Microsoft also announced today that they made some additional protcols available today that are used by their Office 2007 clients. Haven't dug in to see what these are yet however.

So I guess what I'm saying is there may be more options than OM and Web Services.

Consider writing an STSADM extension instead of your own custom command line tool.

As for OM vs. Web Services, the OM is more powerful and is sometimes required over the web services. The OM is also generally easier to code against since you get intellisense, have a lot more documentation, etc. The OM is also faster. If you know your utility will always be run on a machine in the farm (to answer your other question, the OM will work fine from any machine in the farm) then the OM is the best approach.

Assuming your developer has confirmed that both approaches are equally capable of performing the action desired, then the real question becomes will you ever need to use the tool remotely. If the answer is yes, then use Web Services. If the answer is 50/50 then use Web Services. If the answer is 70% (no)/30% (yes) then use the object model and then either rewrite to Web Services or wrap the app with a remotely accessible method (custom web service, a web app, etc) when that remote possibility becomes a reality.