SharePoint Experts, Information Architects, Expert Witness

We provide consulting in a broad array of business and technology from architecture to design to deployment of global systems with a focus on surfacing data in the enterprise. Specialists in Microsoft, we are a premier provider of SharePoint Expertise (including 2016 and Office 365). We also provide Expert Witness/Legal Expert in eDiscovery, source discovery, patent infringement, piracy and more! We also have established SICG DLDS s.a. - our counterpart in Costa Rica that specializes in water systems (http://www.crwatersolutions.com) - Contact me direct: david_sterling@sterling-consulting.com or call 704-873-8846 x704.

Search This Blog

Thursday, December 30, 2010

Failure trying to use SharePoint GetUserProfileByName via web services in WCF or Silverlight

Recently came across an error that seems to have creeped into the SharePoint Web Services - I've checked against 2007 and will against 2010 but I believe the problem is still there. Specificaly when using the UserProfilesService.asmx, I was trying to use the GetUserProfileByName in Silverlight...lo and behold, I get a beaut of an error:

{System.ServiceModel.Dispatcher.NetDispatcherFaultException: The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter
http://microsoft.com/webservices/SharePointPortalServer/UserProfileService:GetUserProfileByNameResponse. The InnerException message was 'Error in line 1 position 375. 'Element' 'IsPrivacyChanged'
from namespace 'http://microsoft.com/webservices/SharePointPortalServer/UserProfileService' is not expected. Expecting element 'Name | Privacy'.'.  Please see InnerException for more details. ---> System.Runtime.Serialization.SerializationException: Error in line 1 position 375. 'Element' 'IsPrivacyChanged' from namespace 'http://microsoft.com/webservices/SharePointPortalServer/UserProfileService' is not expected. Expecting element 'Name | Privacy'.

Spent a good deal of time tracking this one down - fortunately, came across a post so a thanks to Ben McClaren for finding/fixing the problem: The problem is in the WSDL of the Service - the parameters are in the wrong order.

After adding the service reference, open the Reference.CS file that was created - You'll see the parameters that are specified in the wrong order:

1. Name (order not specified)
2. Privacy (order not specified)
3. Values  (order not specified)
4. IsPrivacyChanged  (order specified as 3)
5. IsValueChanged  (order specified as 4)

They need to be:
1. IsPrivacyChanged
2. IsValueChanged
3. Values
4. Name
5. Privacy

Replace the existing code (or simply update as I did) so that it looks like this (note the Order):
 [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, Order = 1)]
    public bool IsPrivacyChanged
    {
      get
      {
        return this.IsPrivacyChangedField;
      }
      set
      {
        if ((this.IsPrivacyChangedField.Equals(value) != true))
        {
          this.IsPrivacyChangedField = value;
          this.RaisePropertyChanged("IsPrivacyChanged");
        }
      }
    }
    [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, Order = 2)]
    public bool IsValueChanged
    {
      get
      {
        return this.IsValueChangedField;
      }
      set
      {
        if ((this.IsValueChangedField.Equals(value) != true))
        {
          this.IsValueChangedField = value;
          this.RaisePropertyChanged("IsValueChanged");
        }
      }
    }
    [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 3)]
    public SharePointProfileViewer.UserProfileServiceReference.ValueData[] Values
    {
      get
      {
        return this.ValuesField;
      }
      set
      {
        if ((object.ReferenceEquals(this.ValuesField, value) != true))
        {
          this.ValuesField = value;
          this.RaisePropertyChanged("Values");
        }
      }
    }
    [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue = false, Order = 4)]
    public string Name {
      get {
        return this.NameField;
      }
      set {
        if ((object.ReferenceEquals(this.NameField, value) != true)) {
          this.NameField = value;
          this.RaisePropertyChanged("Name");
        }
      }
    }
    [System.Runtime.Serialization.DataMemberAttribute(IsRequired = true, Order = 5)]
    public SharePointProfileViewer.UserProfileServiceReference.Privacy Privacy {
      get {
        return this.PrivacyField;
      }
      set {
        if ((this.PrivacyField.Equals(value) != true)) {
          this.PrivacyField = value;
          this.RaisePropertyChanged("Privacy");
        }
      }
    }

FYI AS AN UPDATE:
The above fixes WCF but sadly, not Silverlight....In Silverlight the Service reference returns Null values for everything (Web service works, but service ref does not which leaves little choice in Silverlight) - I'll keep you posted if I find that answer.

Free Web Parts for 2007 and 2010

Stumbled on this site and found some cute web parts that are free - I've been asked for some of these by clients - free is a good price! Most are somewhat silly, but a lot are pretty useful.

Company is Amrein Engineering...

http://www.amrein.com/apps/page.asp?Q=5728

Tuesday, December 7, 2010

That Pesky "Missing Server Side Dependencies" - SharePoint 2010

On just about every install, I've come across the SharePoint Health Analyzer indicating "Missing Server Side Dependencies" - this is a known problem in 2010 (I'm just repeating here for others and my own benefit when I get the question from a client).

Easy fix:

Go to Central Administration > General Application Settings > Farm Search Administration
Click on the Search Service Application to open it (not the Proxy link)

Note: if the Search Service hasn't been set up, it must be before you can do this.

Once opened, close the browser window and run (from Runr or the Command line: IISReset -noforce

Open Central Administration, click on the Health Analyzer link, view the "Missing Dependencies..." message and click the link to Rerun health - problem should be corrected.