asp.net sharepoint development - web-services

Im my current project we need to interface with sharepoint to store and retrieve various documents.
This has previously been done by referencing the Microsoft.Sharepoint dlls directly and going from there. As I don't know a lot about sharepoint yet I have been doing some research.
Most of the examples I find actually refer to using the Sharepoint web services themselves (the various vti_bin ones shown in http://www.sharepointmonitor.com/2007/01/sharepoint-web-service/).
I cant seem to find the differences in approaches. This current project was written a few years ago so maybe the web services weren't available then?
I'm looking for a solution to add and retrieve data from sharepoint and also a little explanation as to the differences in using refernces vs the web service
Cheers

Referincing Microsoft.SharePoint.DLL is only supported on code that runs within SharePoint. It often does work on Projects that are not part of SharePoint but that are run on a SharePoint server, but that's a) unsupported and b) not all functions work. If your Applications runs outside of the SharePoint server, referencing Microsoft.SharePoint.dll won't work.
If you want to access SharePoint from an application outside of SharePoint, there's three ways:
Use the SharePoint Webservices, for example Lists.asmx
If your SharePoint site runs on SharePoint 2010, use one of the three Client Object Models (.net, Silverlight, JavaScript)
Develop some code that runs on the SharePoint Server and exposes the data through a Web Service. This only makes sense if you have to do something that's either complicated/painful to do entirely client side or if you really need full control over the web service.

Related

how to use addin developed with microsoft.sharepoint.dll in other system

I've developed an outlook addin in vs2013. The development machine has sharepoint installed. My code has:
using Microsoft.SharePoint;
But when I run this code on a client machine it shows an error.
enter image description here.In some sites they suggest using Microsoft.SharePoint.Client.dll. Can anyone help?
This won't work as you expected. Microsoft.SharePoint.dll is a server side library which is part of Microsoft SharePoint and hence can neither be referenced nor used otherwise in a client-side environment such as an Outlook add-in.
What you are looking for is Client-Side Object Model, or CSOM for short. However, developing CSOM apps is a completely different story, needs slightly different knowledge and skills. The bad news is most of your SharePoint-related work will have to be redeveloped almost from scratch.
If your SharePoint integration isn't heavy, you might be able to achieve what you want with SharePoint's web services, either REST or SOAP. There an article on MSDN providing insight to various types of SharePoint APIs and providing guidance which API to use in what situation. You shoudl read this first.
we can't use using Microsoft.SharePoint; in sharepoint not installed system.
we need to use using Microsoft.SharePoint.client; for client system and use client object model code.

List item permissions thru SharePoint 2010 Web Services

Through web searches I've seen that SharePoint 2010 Web Services does NOT provide a web service for determining list item permissions (or at least, that was the case for SharePoint 2007). Many web search results, including several here on stackoverflow, ultimately end up linking to the following article:
http://www.codefornuts.com/2009/05/item-level-security-with-sharepoint-web.html
Very promising indeed yet the source code link there no longer works. So, the marked "answer" to all of these questions has become a bit of a non-answer. I can go try to create my own custom web service but the previously provided answer would be fantastic. Does anyone know where that source code can be found? Does anyone know whether SharePoint 2010 has an OOTB web service to access list item permissions?

Remotely access info path field in SharePoint 2007

I have sharepoint document library which contains infopath files, however I want to write a c# console program to read a field of infopath file, from a client machine, via sharepoint web service.
how do i do that? I am not allowed to deploy any code to sharepoint server.
Couple steps involved.
1. Get the infopath file from the Sharepoint server using webservices. You most likely will use GetListItems to find the name/URL of the file and then you can use a webclient class to stream the file.
2. Once you have the file locally (in memory) you can read any infopath using the standard XMLReader class methods.
Shouldn't be terribly complicated but does involve a few different technologies (web services, web client, XML).
One other option would be to promote the field from the form into the SharePoint library (providing it is not a field in a repeating section or a rich text field) and then use the lists web service (http://mysite/_vti_bin/lists.asmx) to find your record and read the promited fields value from the returned results in web services.
Here is a link that will hopefully help you wish the lists.asmx web service (if you need it): http://msdn.microsoft.com/en-us/library/lists.lists.getlistitems(v=office.12).aspx
Hope this helps

Sharepoint Web Services Tutorial

I'm trying to upload documents to SharePoint using web services attaching custom metadata to the files. I've searched but have not found a good tutorial covering all these topics. Can anybody point me in the right direction?
Here's why I think I need to use web services:
I'm developing on XP and the Sharepoint object model is not remotable. This means any code which has "using Microsoft.Sharepoint" is out :-(
I'm looked into the CopyIntoItems web service but am having trouble implementing it myself. I was hoping for a clear tutorial. I've tried using the sample code from http://msdn.microsoft.com/en-us/library/copy.copy.copyintoitems.aspx , but I'm not sure what my sourceURL should be. Also, since I can't use "Microsoft.Sharepoint" references, I'm wondering what my Fields will look like? (Is this my metadata?) Also, I'm curious as to why only Website projects allow me to add a web service.
Once the file is "in" Sharepoint using that web service, I'll have to use another one to update custom columns, or metadata. Some of these are freeform text, but other must match entries in lists or lookups. I haven't found any information on this yet.
Thank you for your help!
Here is some code http://geek.hubkey.com/2007/10/upload-file-to-sharepoint-document.html
As for why it is that is the way because Microsoft wrote it that way :). Some people have written custom web services that combine them, http://www.sharepointblogs.com/ssa/archive/2006/11/30/wsuploadservice-web-service-for-uploading-documents-into-sharepoint.aspx
Using the built in web services you have to upload the file and upload CAML which contains the columns. Another option if you are using a MS-Office document is to make sure the author fills in the properties in the document then you can have those fields displayed in sharepoint.
Here is some stuff on the Sharepoint Designer - http://office.microsoft.com/en-us/sharepointdesigner/FX100487631033.aspx
Hope that helps a little.
You can link to the Sharepoint 2007 training from here: http://office.microsoft.com/en-us/training/HA102358581033.aspx
The designer I believe has a WS example in it.

Sharepoint web services to edit existing list from desktop

Perhaps I am not asking or searching for this correctly:
I want to have a desktop script (currently using python) that will update a list on a sharepoint site.
The current script reads various file shares, ftp sites and a ArcGIS database to determine which metadata files have been updated and published. The script then writes all these results to a Excel spreadsheet.
We would like to do the same thing, but keep the data in a Share Point list instead of a spreadsheet. We don't need to upload any files (which is what I keep running across in my search) but just update or add to a list.
We could care less about what language or tools we use, we just don't have access to any custom coding on the Share Point server.
You should be able to use the lists webservice on the Sharepoint server,
the url is normally:
http://host/sitename/_vti_bin/lists.asmx
you are looking at the UpdateListItems webservice call. I don't know python but I use C# and work with sharepoint every day you can find a working example on MSDN on a Windows app to call the web service.