Viser opslag med etiketten Webservices. Vis alle opslag
Viser opslag med etiketten Webservices. Vis alle opslag

mandag den 2. marts 2009

InfoPath - Get the current user without writing code

  1. With InfoPath opened go to Tools > Data Connections, and click 'add...' to add a new data connection to the form. This opens up the Data Connection Wizard.
  2. We want to receive data from the WS about the current user, so choose receive data' and click next.
  3. Our data source is a WS so choose 'Web Service' and next.
  4. Now you will have to point the wizard to the WS. Type an address similar to this: http://ServerName/_vti_bin/UserProfileService.asmx and click next.
  5. Here you get a list of all methods for that WS, choose GetUserProfileByName and click next.
  6. In this screen you can specify what parameters are sent to the method, we are relying on the method's ability to return the current user name if no value is passed to it, so we will leave this as is (no value is passed to the method) and click next.
  7. Click next and make sure 'Automatically retrieve data when form is opened' is checked.
  8. Finish the wizard.

The GetProfileByName method returns a PropertyData array. You can think of it as a repeating table of name and value pairs. So Now that you have a data connection that can get the current users, you can use it values. In this example I will show the user's first name in a textbox.

  1. Add a textbox to the form.
  2. Go to the first textbox's properties (double click it).
  3. In the 'Default Value' part, click the 'fx' button next to the 'Value' field. this opens up the formula builder dialog.
  4. Click 'Insert field or group'.
  5. In the data sources drop down, choose the GetUserProfileByName data source.
  6. Expand all groups under the 'dataFields' group, and choose the 'value' field. Don't click OK yet!
  7. With data 'value' field selected, click the 'Filter Data...' button and 'Add...'.
  8. In the first drop down (value) select 'Select a field or group...' and choose the 'Name' field under the 'PropertyData' group.
  9. Leave the middle drop down as is ('is equal to') and in the last drop down choose 'type a text...'.
  10. This is the part where you specify which property to put in the textbox. As we said the method returns multiple properties about the user. For this textbox we want to put the user's first name in, so type 'FirstName' (this is case sensitive!). I have included the property list you can use here (just below), so if you want some other property, just type its name instead.
  11. That's it, all we have to do is to confirm everything so Click 'OK' for every open dialog box until you are back in the design mode.
  12. click 'Preview' and see the wonder!
  13. If you want more details repeat steps 1-11 and enter different property names in step 10.

Finally, as I Promised, here is the complete list of default profile properties get returned by the userprofileservice. I think they are pretty self explained:
UserProfile_GUID
AccountName
FirstName
LastName
PreferredName
WorkPhone
Office
Department
Title
Manager
AboutMe
PersonalSpace
PictureURL
UserName
QuickLinks
WebSite
PublicSiteRedirect
SPS-Dotted-line
SPS-Peers
SPS-Responsibility
SPS-Skills
SPS-PastProjects
SPS-Interests
SPS-School
SPS-SipAddress
SPS-Birthday
SPS-MySiteUpgrade
SPS-DontSuggestList
SPS-ProxyAddresses
SPS-HireDate
SPS-LastColleagueAdded
SPS-OWAUrl
SPS-ResourceAccountName
SPS-MasterAccountName
Assistant
WorkEmail
CellPhone
Fax
HomePhone

onsdag den 8. oktober 2008

SharePoint Web Services

Her er en oversigt over webservices i sharepoint. For mere inforamtion se Sharepoint Service 3 - SDK: http://msdn.microsoft.com/en-us/library/cc752745.aspx


Friendly Name

Location

Description

Alerts

/_vti_bin/alerts.asmx

Provides methods for working with alerts for list items in a SharePoint site.

Area Web service

/_vti_bin/areaservice.asmx

Deprecated Web service. Provides an area interface for remote clients.

Authentication Web service

/_vti_bin/Authentication.asmx

Provides ability for Web services to operate in conjunction with forms authentication.

BDC Fields Resolver Web service

/_vti_bin/bdcfieldsresolver.asmx

BDC Fields Resolver Web service for client applications. Reserved for internal use only.

BDC Web service

/_vti_bin/businessdatacatalog.asmx

Business Data Catalog metadata Web service. Reserved for internal use only.

CMS Content Area Toolbox Info Web service

/_vti_bin/contentAreaToolboxService.asmx

Designed for use by the Microsoft Office SharePoint Designer client to use.

Copy Web service

/_vti_bin/Copy.asmx

Provides methods for copying items between locations in the SharePoint environment.

List Data Retrieval Web service

/_vti_bin/DspSts.asmx

Provides a method for performing queries against lists in Windows SharePoint Services.

Document Workspace Web service

/_vti_bin/DWS.asmx

Provides methods for managing Document Workspace sites and the data they contain.

Excel Services Web service

/_vti_bin/ExcelService.asmx

Provides methods to call Excel Services remotely or to work as a callback for Web Parts.

Forms Web service

/_vti_bin/Forms.asmx

Provides methods for returning forms used in the user interface when working with the contents of a list.

Forms Services proxy Web service

/_vti_bin/FormsServiceProxy.asmx

Provides methods for Forms Services to proxy requests to remote data sources from Web-based forms.

Forms Services Web service

/_vti_bin/FormsServices.asmx

Provides methods to call Forms Services remotely or to work as a callback for Web-based forms.

Imaging Web service

/_vti_bin/Imaging.asmx

Provides methods that enable you to create and manage picture libraries.

Lists Web service

/_vti_bin/Lists.asmx

Provides methods for working with lists and list data.

Meetings Web service

/_vti_bin/Meetings.asmx

Provides methods that enable you to create and manage Meeting Workspace sites.

Official File Web service

/_vti_bin/officialfile.asmx

Provides methods for sending files to a records repository.

People Web service

/_vti_bin/People.asmx

Provides methods for working with security groups.

Permissions Web service

/_vti_bin/Permissions.asmx

Provides methods for working with the permissions for a site or list.

Published Links Web service

/_vti_bin/publishedlinksservice.asmx

Office system client applications and other applications can obtain the list of published links on the server that are targeted to the current user.

Publishing Service Web service

/_vti_bin/PublishingService.asmx

Provides methods to remotely work with the publishing service.

Search Web service

/_vti_bin/search.asmx

Allows access to Enterprise Search results from client applications and Web applications outside of the context of a SharePoint site.

SharePoint Directory Management Web service

/_vti_bin/sharepointemailws.asmx

Provides methods for remotely managing distribution groups.

Sites Web service

/_vti_bin/sites.asmx

Provides methods for returning information about the site templates for a site collection.

Slide Library Web service

/_vti_bin/SlideLibrary.asmx

Provides methods for slide library callbacks or remote publishing of slides.

Search Crawl Web service

/_vti_bin/spscrawl.asmx

Provides methods for remote Office SharePoint Server 2007 server farms to crawl a local farm.

Search Web service

/_vti_bin/spsearch.asmx

Provides methods for remotely performing searches within a Windows SharePoint Services deployment.

Users and Groups Web service

/_vti_bin/UserGroup.asmx

Provides methods for working with users, site groups, and cross-site groups.

User Profile Change Web service

/_vti_bin/userprofilechangeservice.asmx

Provides methods to query the user profiles change log remotely.

User Profile Web service

/_vti_bin/userprofileservice.asmx

Provides a user profile interface for remote clients.

Versions Web service

/_vti_bin/versions.asmx

Provides methods for working with file versions.

Views Web service

/_vti_bin/Views.asmx

Provides methods for working with views of lists.

Web Part Pages Web service

/_vti_bin/webpartpages.asmx

Provides the methods to send information to and retrieve information from Web services.

Webs Web service

/_vti_bin/Webs.asmx

Provides methods for working with sites and subsites.

Workflow Web service

/_vti_bin/workflow.asmx

Provides methods to work with workflows.