Archive for the ‘SharePoint Development’ Category

SharePoint Web Services – Creating New Sites

Thursday, December 31st, 2009

SharePoint offers a very good object model which allows a developer to achieve just about anything. But what happens in situations when the developer must achieve certain functionality, but his or her code is not running on a server hosting SharePoint? That’s where the SharePoint Services step in.

Anyone who has tried to manage content in SharePoint using SharePoint Services knows that it can be a very challenging task. A lot of functionalities are limited, or don’t exist at all. Some of them are very basic and it can be a real mind cracker when it comes to the development of more complex functionalities. For example, there is no service that provides the method to delete a web site – a quite extraordinary fact, if I may add. Of course, the developer may develop a custom web service and use it for his or her purpose. However, sometimes a client requires the development of an application which is not allowed to add anything to the server machines. When that happens, the only tool left for the developer to use is the existing coding arsenal and his or her wit.

One of the very common and basic functionalities that may arise in the never ending list of client requirements is to develop a code which creates SharePoint sites. This should be rather easy, right? Well, not quite so. On this MSDN page you may see the list of all available web services. A web service websvcSites may appear tempting judging by its name, but it deals with the site content migration and site templates information. The websvcAdministration web service “provides methods for managing a deployment of Windows SharePoint Services, such as for creating or deleting sites”, as stated on the page. Unfortunately, by the term sites the documentation actually refers to site collections, thus our problem still remains unsolved.

The solution, believe it or not, lies in the web service called websvcMeetings. This service contains a class Meetings with a method CreateWorkspace. The purpose of this method is to create SharePoint meeting workspaces. It may seem odd to use such a method, because we are not actually trying to create a meeting workspace, but a site instead. The key lies in one of the method arguments – site template. By providing a site template other than the meeting workspace template, the method will create a corresponding site. This small trick extends the purpose of the method and solves the challenge of creating SharePoint sites using SharePoint web services.

The complete list of SharePoint’s default site templates can be found on this page. For custom templates, the developer should provide the name of the site template file which has been previously uploaded to the site collection’s site template gallery.

There are a few disadvantages with this method. For example, there is no option to set the permissions inheritance or whether the new site will contain the top navigation bar from its parent site. Actually, there are no SharePoint web services for the top navigation what so ever. This and many other disadvantages are eagerly expected to be implemented and enriched in the future releases of SharePoint platform.

VN:F [1.0.8_357]
Rating: 10.0/10 (1 vote cast)

Share/Save/Bookmark

InfoPath and MOSS Web Services

Friday, September 11th, 2009

InfoPath form templates in MOSS are widely used because there are many reasons that empower both servers.

The most common situation is that you need to pick-up some user information from MOSS and show / manipulate it on an InfoPath form. There are a few possible ways to make it work, with or without coding. The most powerful thing is by using web services provided by MOSS.

To be able to use web services in InfoPath, you should create a new Data Connection (Tools-> Data Connection). When the wizard starts, define what you would like to do with the data: submit or receive. Select Web services as a source of data and define the web service’s location. For getting user profile information (email, phone number, preferred name, etc) use MOSS services located at http://MOSSServerName/_vti_bin/UserProfileService.asmx.

  • This service is not available if you are using Windows Share Point Services but only Microsoft Offices SharePoint Server.
  • Some of available public methods are listed below:
    • AddColleague
    • AddLink
    • AddMembership
    • AddPinnedLink
    • CreateMemberGroup
    • CreateUserProfileByAccountName
    • GetCommonColleagues
    • GetCommonManager
    • GetUserLinks
    • GetUserProfileByGuid
    • GetUserProfileByIndex
    • GetUserProfileByName
    • ModifyUserPropertyByAccountName
    • RemoveMembership
    • UpdatePinnedLink, etc.

Moving forward, you can take the profile data for any current or other MOSS user. For users currently logged on, you should be able to pick-up some profile info when the form is loading. For non-current users, you have a lot different cases and you can pick data on the field value changed or drop down list value selected or something else.

If you need to handle some of the available events, you should have VSTA installed (Visual Studio Tools for Applications). If you do not have it, you will not be able to create event handlers at all. To enable it, find Microsoft Office in list of Add/Remove programs. Select Change option and add find those tools for InfoPath. Select the option to install it.

Now you can create event handlers by selecting a control, right click on it, then Programming and selecting the desired event. The most interesting case is if you have a drop down list with a few names and you would like to send an email to the selected one. Before we continue, just to note that the drop down list item has a Value and a Display Name. This can give us the possibility to hide non user-friendly data. So, if you decide to get email defined in MOSS for selected user, assign the Account Name as Value for each item in the drop down. Display value can be as you wish…

When VSTA is running, add reference to UserProfileService and name it. Code in the event handler should look like:

XPathNavigator XPathNav = MainDataSource.CreateNavigator();

 

ServiceReferenceName.UserProfileService profile = new ServiceReferenceName.UserProfileService();

   profile.UseDefaultCredentials = true

   profile.PropertyData[] userProperties = null;

 

    try {

              userProperties = profile.GetUserProfileByName(SelectedDDLValue);

    }

    catch { }

 

    if (userProperties == null || userProperties.Length == 0) {

        return;

    }

    for (int i = 0; i < userProperties.Length; i++) {

        XPathNavigator node = null;       

            case “workemail”:

                node = XPathNav.SelectSingleNode(“/my:emailField/my:userEmail”, NamespaceManager);

                break;

            default:

                continue;

        }

       ServiceReferenceName.ValueData[] values = userProps[i].Values;

        if (values.Length > 0) {

            if (node != null && string.IsNullOrEmpty(node.Value)) {

                node.SetValue(values[0].Value.ToString());

            }…

The email field can be hidden or visible, it depends on what information you would like to share with the user.

  • In some cases, you can experience that drop down list events do not react as you expect. Try to avoid this by setting “Always Postback” option on drop down list property.
VN:F [1.0.8_357]
Rating: 7.7/10 (3 votes cast)

Share/Save/Bookmark

Microsoft SharePoint 2010 Sneak Peek for Developers

Wednesday, July 15th, 2009

View a sneak peek of Microsoft SharePoint 2010 for Developers. SharePoint 2010 provides a robust development platform to rapidly build solutions using familiar tools like Visual Studio 2010 and SharePoint Designer 2010. Developers gain access to a rich set of out-of-the-box features such as Business Connectivity Services for read/write integration between external application data, the web, and Office 2010 client.

Feature Highlights:

  • Visual Studio 2010 SharePoint Tools
  • Language Integrated Query (LINQ) for SharePoint
  • Developer Dashboard
  • Business Connectivity Services
  • Client Object Model (OM)
  • Silverlight Web Part

View the Sneak Peek Video:

Microsoft SharePoint 2010 Sneak Peek for Developers

VN:F [1.0.8_357]
Rating: 0.0/10 (0 votes cast)

Share/Save/Bookmark

Microsoft Office SharePoint Practices: Usage of Content Types

Wednesday, June 3rd, 2009

We have posted a new MeritCare Training Session, this one covering Microsoft Office SharePoint Server.

Microsoft Office SharePoint Practices: Usage of Content Types

Site content types in the Microsoft Office SharePoint platform are defined as a reusable group of settings for a category of content. In this training session, we will present their usage to manage the metadata, templates, and behaviors of items and documents consistently. We will show you how to organize the content of your collaboration portal in a meaningful way and associate the same capabilities to your content across your document management solution.

Date: 7/08/2009
Time: 10:00 - 11:00 CST

Register now for the free Microsoft Office SharePoint Practices training session.

VN:F [1.0.8_357]
Rating: 0.0/10 (0 votes cast)

Share/Save/Bookmark

SharePoint Designer 2007 Available as a Free Download

Thursday, April 2nd, 2009

Coming from the Microsoft SharePoint Team Blog, starting today (April 2, 2009), SharePoint Designer 2007 will be available as a free download.

The team is hoping this free download will lead to more SharePoint Customizations.

Learn more about the free download on the MSDN SharePoint Team Blog site.

VN:F [1.0.8_357]
Rating: 0.0/10 (0 votes cast)

Share/Save/Bookmark