Monday, January 18, 2010

Nothing New Today

Today I'm in master page hell. I'll try to document it if I end up troubleshooting my problem instead of just nuking it and starting over.

In the meantime, some jerk sent me this site: http://www.firstpersontetris.com/

If you enjoy retro video games, I'd highly recommend it.

Friday, January 8, 2010

How to Hide List Views from the Drop Down List

If, like me, your SharePoint is closer to OOTB than not, when you create a new public list view the view automatically shows up in the drop down list in the upper right hand corner. This is neat if you want your users to be able to look at all of the views you create. Otherwise, not so much.

The Problem: I want people to be able to see the views I create but I don't want them to show up in the drop down list. I may or may not have accidentally created tons of views when I created new webpages in the Designer. Oops.

To remedy this I created a little command line program in C# that changes the Hidden property of the view. The MSDN documentation says that the SPView.Hidden property "specifies whether the view is hidden." Gee. Thanks. Helpful. Jerks. So, apparently this property lets you hide the view from the drop down list. I have no idea what else it does, though, so don't blame me if it blows your stuff up.

My code looks a little bit like this:

List<SPView> views = new List<SPView>();
foreach (SPView v in <my list>)
{
     if (<criteria goes here>)
     {
          views.Add(v);
     }
}
foreach (SPView v in views)
{
     v.Hidden = true;
     v.Update();
}

Yes, the two loops are necessary. Yes it's annoying. But yes, it works.

EWS, Error 403, and IIS 6.0

When I tried to navigate to http://(mysite)/ews I got an HTTP error 403 with the message "The website declined to show this webpage". The details say "Internet Explorer is able to connect to the website, but Internet Explorer does not have permission to display the webpage..."

This reads to me like IIS is saying "I don't feel like showing you this page. Maybe tomorrow..."

Ugh. Thanks for being descriptive!

To fix this, all I had to do was go into IIS, navigate to the root for EWS, click Default Document --> Add... then type in "exchange.asmx" (no quotes).

Note that exchange.asmx redirects to services.wsdl, at least with my configuration.

Also, I probably didn't really need to do that to be able to use my Web Services, but hey. I didn't know that going in and when I see an error, I troubleshoot it.

Filter by Person or Group Column Type

The Problem: I have a column called Attendees of the type "Person our Group." Furthermore, Attendees can contain multiple entries. When someone is viewing this view, I'd like them to be able to only see the items in which they are listed as an attendee.

When I try to filter by the criterion Attendees contains [Me] I get the following error:

"The filter type you selected cannot be used with this type of column. You can apply the 'contains' operator only to the columns that have the type Single line of text, Multiple lines of text, or Choice. Specify a different operator for the filter or change the column type. You can then attempt to create the filter again."

Lame!

To get around this, I use SharePoint Designer.

First, through the web interface I create the view that I want and filter on a random text column (e. g. randomTextColumnName contains [Me]). If I view the page now it'll say <!-- #RENDER FAILED -->. Whatever Microsoft.

To fix this, I now open the page for the view in the Designer and search for the internal name of my randomly chosen text column. When I get to the code that looks kind of like this:

...Contains&gt;&lt;FieldRef Name"TextColumnName"/&gt;&lt;...

(note that the quotation marks might read as &quot; - same difference for our purposes)
I can then change "TextColumnName" to the correct, internal name of the column (in my case, Attendees). Save and you're done.

Yeah. That's it. Silly, huh?