Wednesday, October 28, 2009

prompted for login and then 401.1 Access Denied when accessing Shared Services

Many people have written about this problem. When you are in the SharePoint Central Administration site, and click one of the Shared Services you created on the left Quick Launch menu (e.g. SharedServices1), you are prompted for login repeatedly and it eventually shows your the 401.1 Unauthorized: Access is denied due to invalid credentials error.

I have summarized below the possible causes and fixes that I have found on the web:
  1. Because the SSP URL has a domain name different from the machine name. This is almost always the case. A security feature called "loopback check" introduced in Windows 2003 SP1 and onward is the reason fro this. Apply a registry change on the server by following the MSFT support at http://support.microsoft.com/kb/926642/

  2. Because the name of the SSP you created (e.g. SharedServices1) happens to be the same as the name of the AppPool for the SharePoint Web Application that hosts the Shared Services Admin site. They must be named differently as the SSP instance will creates a AppPool automatically under its name.

  3. The SSP site collection administrators has only one user account. Not sure why this is would be a problem but adding a secondary administrator to the site collection helped with some of this error.

Friday, July 10, 2009

Aggregate a generic List into a generic Dictionary using LINQ

Let's say I have a a generic list of contacts, where contacts are instances of my class Contact:

class Contact {
public string Name { get; set; }
public string StreetAddress { get; set; }
public string ZipCode { get; set; }
.....
}

List myContacts = new List();
//add instances of Contact.

Now what if I want to aggregate the contacts by ZipCode (or by some other external values like contact type, and store the aggregated results in a generic Dictionary, with the GROUP BY values as the keys and the list items as the values? It's pretty straightforward when the List has primitive types, but not when it's a class like what I have. Here's one way to convert:

List<Contact> contacts = new List<Contact>();

//add some instances of Contact

Dictionary<string, List<Contact>> contactsByLocation = new Dictionary<string, List<Contact>>();

var result = (from c in contacts

group c by m.ZipCode into g

select new { g.Key, g }).ToDictionary(g => g.Key, g => g.g);

foreach (string s in result.Keys)

{

IGrouping<string, IndexModification> temp = result[s];

List<IndexModification> items = temp.ToList<IndexModification>();

contactsByLocation.Add(s, items);

}


I have to say this is much more cumbersome than I like. Hopefully I can find a better way do this later.


Saturday, February 28, 2009

System.InvalidOperationException: Correlation value specified does not match the already initialized correlation value on declaration approveRejectTas

Continuing with new discoveries of SharePoint workflow stuff, I ran into this logged exception after I added a SendEmail activity to my previously working workflow. So I know it's gotta be something in this Activity, which runs after a new Task is created in the workflow. Like every other Activity in the pipeline of the task process (Create Task, OnTaskChanged, CompleteTask etc), I gave this one the same correlation token as the task level token. Turn out that's the problem. Apparently the SendEmail activity (and a few other activities such as LogActivity) can only assume the workflow level correlation token.