Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am looking to replicate the same SharePoint integration behaviour as seen in MS Office e.g. in Word, if you open a file stored in SharePoint it will automatically detect whether the file is currently checked out, or whether it requires checking out.

After some investigation, I have found that Office uses a various number of ways to integrate with SharePoint based on how you have actually accessed the document e.g. Mapped Drive/Web folders etc. - Communicating with SharePoint

I am looking for some advice on what is the most efficient (but reliable) way of determining whether the URL the user has selected actually resides in SharePoint?

It is a Win32 app & I am restricted to using SharePoint Web Services (can't use the SharePoint Object Model). Looking to target SharePoint 2007 onwards.

So far I have came to the conclusion I am going to have to use web services to attempt a connection, if it succeeds then I know the user has selected a file residing in SharePoint.

Does this seem like a reasonable approach? Can you suggest a better alternative?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

There are a few ways. The easiest way to have your code call the server directly and then look at the http headers in the response. By default SharePoint includes the "MicrosoftSharePointTeamServices" header that indicates not only that it is running SharePoint but also what version.

If that is not an option, look into making an OPTIONS request to the server like Office does. For the specifics of this, fire up Fiddler, then click on an office document from a document library in SharePoint and let it open in the Office app. Now look at the sessions that Fiddler captured. There should be the initial GET request from the browser, then an OPTIONS request from Office.

share|improve this answer
    
+1 I actually used Fiddler earlier and opened documents via Word from a mapped drive and then the same document from the direct URL & I did notice the GET/OPTIONS requests you mentioned. Appears like this is probably going to be the best approach, however, I will leave this open for now to see if anyone else has any other alternatives. Thanks. –  James Oct 10 '11 at 16:23
    
Would the same server call work if SharePoint was installed on a Virtual Directory? –  James Oct 11 '11 at 7:53
    
This should work as long as SharePoint is involved in the request –  Dave Wise Oct 11 '11 at 15:10
    
Thanks, I wrote a small prototype today using simple web requests and it worked like a charm. –  James Oct 11 '11 at 15:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.