Showing Sharepoint data in silverlight using Sharepoint web services.
Reference:
1) Create a silverlight application.
Add a reference to your SharePoint web service. Select Project, Add Service Reference…
In the Add Web Reference dialog box, enter the URL of the ‘Lists’ web service. Web services in SharePoint are located in the ‘_vti_bin’ directory under the relevant site. If you are using web services to access your My Site, then enter the URL: ‘http://my/sites/your-alias- here/_vti_bin/lists.asmx’. If you are using web services to access a SharePoint site located at http://ourteamsite, the URL will be ‘http://ourteamsite/_vti_bin/lists.asmx’.
Click the Go button to confirm the URL. If you have entered a valid URL, then this dialog box tells you that it found a web service. The dialog box will be populated with the various operations available in the web service.
Change the web reference name to something relevant. For accessing the Lists web service, a good web reference name is ‘ListsWebService’.
Silverlight Application Page code
public partial class MainPage : UserControl
{
string test;
public MainPage()
{
InitializeComponent();
try
{
ListsSoapClient proxy = new ListsSoapClient();
proxy.GetListItemsCompleted += new EventHandler<GetListItemsCompletedEventArgs>(proxy_GetListItemsCompleted);
XElement Query = new XElement("Query");
XElement viewfield = new XElement("ViewFields");
XElement QueryOptions = new XElement("QueryOptions");
proxy.GetListItemsAsync("MyContacts", null, Query, viewfield, null, QueryOptions, null);
}
catch (Exception ex)
{
LBL_Name.Text = ex.Message;
}
}
void proxy_GetListItemsCompleted(object sender, GetListItemsCompletedEventArgs e)
{
test = "";
XNamespace ns = "#RowsetSchema";
var query = from x in e.Result.Descendants()
where x.Name == ns + "row"
select x.Attribute("ows_Title").Value;
foreach (string t in query)
test = t + " - " + test ;
LBL_Name.Text = test;
}
Types of Sharepoint web services description
WSS Web Services | Web Reference |
Administration Service | http://<server-url:port-number>/_vti_adm/admin.asmx |
Alerts Service | http://<server-url>/_vti_bin/alerts.asmx |
Document Workspace Service | http://<server-url>/_vti_bin/dws.asmx |
Forms Service | http://<server-url>/_vti_bin/forms.asmx |
Imaging Service | http://<server-url>/_vti_bin/imaging.asmx |
List Data Retrieval Service | http://<server-url>/_vti_bin/dspsts.asmx |
Lists Service | http://<server-url>/_vti_bin/lists.asmx |
Meetings Service | http://<server-url>/_vti_bin/meetings.asmx |
Permissions Service | http://<server-url>/_vti_bin/permissions.asmx |
Site Data Service | http://<server-url>/_vti_bin/sitedata.asmx |
Site Service | http://<server-url>/_vti_bin/sites.asmx |
Users and Groups Service | http://<server-url>/_vti_bin/usergroup.asmx |
Versions Service | http://<server-url>/_vti_bin/versions.asmx |
Views Service | http://<server-url>/_vti_bin/views.asmx |
Web Part Pages Service | http://<server-url>/_vti_bin/webpartpages.asmx |
Webs Service | http://<server-url>/_vti_bin/webs.asmx |
A summary of the “Windows SharePoint Services” web services
WSS Web Services | Description |
Administration Service | This web service provides administrative capabilities like creating a new top-level site, deleting a top-level site and getting the list of available languages. |
Alerts Service | Provides access to the list of active alerts and allows to delete active alerts. |
Document Workspace Service | This web service is used to manage Document Workspace sites. It allows to create new document workspaces, delete document workspaces, create new sub-folders, delete sub-folders, etc. |
Forms Service | Each list has forms associated which are used to display list items, create new list items and update or delete existing list items. This web service allows to get the collection of forms associated with a list and then get detailed information about each form. |
Imaging Service | SharePoint has picture libraries which users can use to manage pictures. This web service allows to upload pictures, download pictures, create new folders, delete folders and pictures, etc. |
List Data Retrieval Service | Allows to run XPath like queries against a list. |
Lists Service | This web service is used to work with lists and list data. You can obtain the collection of lists, add new lists, remove lists, add new list attachments, remove attachments, etc. |
Meetings Service | This web service is used to work with Meeting Workspaces. You can create a new Meeting workspace, remove an existing Meeting workspace, add new meetings, add new meetings using ICal files, etc. |
Permissions Service | Sites and lists have permissions assigned to them. This web service is used to obtain the permissions assigned to a list or site, add new permissions and update or removing existing permissions. |
Site Data Service | The Site Data web service can be used to return meta-data about a site or list, get the collection of lists, get the attachments for a list item, get the collection of items in a list, etc. |
Site Service | This web service can be used to return the list of site templates. When you create a new site using the Administration web service you need to specify the site template name to use which you can obtain through this web service. |
Users and Groups Service | This web service is used to work with users, site-groups and cross-site groups. You can add, update or remove users, site-groups and cross-site groups. You can also add users or cross-site-groups to a site-group. |
Versions Service | Document Libraries and Picture Libraries can have versioning enabled, which stores a copy of every single file version. This web service can be used to get the list of available versions, delete versions and also restore a file version. |
Views Service | Lists have views associated which define what fields are shown, what filtering and sorting is applied, what grouping is applied, etc. This web service is used to work with list views. You can get the collection of views, add new views, remove views, update the Html code used to display a view, etc. |
Web Part Pages Service | Web Parts are objects which you can place on web part pages. This web service is used to work with web parts and web part pages. You can get the list of web parts on a page, you can add or remove web parts, etc. |
Webs Service | This web service is used to work with sites and sub-sites. You can get the list of list-templates, get meta-data about a sub-site, get the list of sub-sites, etc. |
A summary of the SharePoint Portal Server web services
SharePoint Portal Server provides the same web services as Windows SharePoint Services. It also provides the following five additional web services.
WSS Web Services | Description |
Area Service | Areas are sections used in SharePoint Portal Server to group content. This web service allows to manage areas. You can create new areas, update areas, remove areas, get the list of sub-areas, etc. |
Query Service | The Query web service is used by clients to search SharePoint. You can send in complex search XML requests and get a result-set of matches. |
User Profile Service | Users in SPS have user profiles that are used to target content to audiences (users). This web service allows to obtain user profile information. It does not allow to create or modify user profiles. |
SPS Crawl Service | This web service is undocumented and is used by SharePoint itself for site crawling purposes. |
Outlook Adapter Service | Provides the same capabilities as the Alerts web service of WSS. |
The table below shows the URLs to use for each web service provided by SharePoint Portal Server. You can add them the same way as the WSS web services described above.
WSS Web Services | Web Reference |
Area Service | http://<server-url>/_vti_bin/areaservice.asmx |
Query Service | http://<server-url>/_vti_bin/search.asmx |
User Profile Service | http://<server-url>/_vti_bin/userprofileservice.asmx |
SPS Crawl Service | http://<server-url>/_vti_bin/spscrawl.asmx |
Outlook Adapter Service | http://<server-url>/_vti_bin/outlookadapter.asmx |
0 comments