One of the biggest kinks I’ve had to work out so far on Windows 8 is fighting with UAC. Since I do a lot of SharePoint 2010 development, I need to run Visual Studio as an Administrator in order for the SharePoint tools in Visual Studio to work properly. After using Windows 8, I quickly found out that you can’t completely disable UAC in Windows 8. Continue Reading →
The Blog
After installing SharePoint 2010 on Windows 8 RTM, I noticed that the SharePoint PeoplePicker wouldn’t seem to resolve my service accounts. Everything would have a red underline.
After scratching my head for a bit, I realized the PeoplePicker actually did resolve the names properly, it was just that the damned IE10 spell checker was underlining the service account name with almost the exact same underline that is used when SharePoint can’t resolve a name! The clue was when I tried to resolve myself, and I saw that only my last name was underlined. Don’t let it fool you folks!
I recently created a custom service application administration page which collected a username and password of a service account. I wanted to display a warning to the user if they were not on a secure HTTPS channel, similar to the one that SharePoint provides when you attempt to start the User Profile Synchronization service. In looking at the out of box pages in the ADMIN directory, the code that SharePoint uses is quite simple:
1 2 3 4 5 6 7 8 |
<div id="SslWarning" style="color:red;display:none"> <SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,SSL_warning%>" EncodeMethod="HtmlEncode"/> </div> <script language="javascript"> if (document.location.protocol != 'https:') { var SslWarning = document.getElementById('SslWarning'); SslWarning.style.display = ''; } </script> |
Here is a link to a panorama I took of Mt. St. Helens from the south side, near the Lahar viewpoint. I had never been to that side of the mountain before, and it was well worth the long trip. The views of the mountain were incredible, and there were several excellent hikes, including Ape Cave, Ape Canyon, Lava Canyon (with an awesome suspension bridge ala Indiana Jones for the kids), June Lake and more. It is also National Forest land, so you can pretty much camp anywhere you want. We just pulled over off the road near Lahar and found a nice secluded spot.
The panorama is of 31 separate photos that I took with the rapid shoot settings on a Nikon D5000. I didn’t have a tripod, just held the camera still as I panned manually. The Microsoft Image Composite Editor did a great job stitching the photos together.
If you’ve seen the out-of-box MySite Host, you’ll notice that it doesn’t have a normal search box included as part of the master page, and instead just has a Find People search box:
When you perform a search with this box, you are taken to the people scope results page (PeopleResults.aspx) in the Search Center that is defined in your User Profile Service Application’s My Site Settings > Setup My Sites page.
If you go to your My Site Host’s Site Settings > Site Collection Administration > Search Settings page, you’ll see that by default it’s configured to not use custom scopes, to not show the scopes dropdown, and to use the OSSSearchResults.aspx page for contextual scopes. The settings on this page are completely ignored by the Find People search box on the MySite Host master page (because it looks to the Search Center configuration in the User Profile Service Application).
If you dig into the mysite.master, you will not find a SearchBox or SearchBoxEx control, and will find that the PlaceholderSearchArea is set to Visible=”false”:
1 2 3 4 5 6 7 8 |
<div class="s4-die"> <asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server" Visible="false"/> <asp:ContentPlaceHolder id="PlaceHolderGlobalNavigation" runat="server" Visible="false" /> <asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server" Visible="false" /> <asp:ContentPlaceHolder id="PlaceHolderGlobalNavigationSiteMap" runat="server" Visible="false" /> <asp:ContentPlaceHolder id="PlaceHolderTopNavBar" runat="server" Visible="false" /> <asp:ContentPlaceHolder id="PlaceHolderHorizontalNav" runat="server" Visible="false" /> </div> |
Digging in to the mysite.master, there is a DelegateControl called GlobalNavigation, and if you look at a Feature called MySiteNavigation, you’ll find that it references an ASCX control for this delegate control:
1 2 3 |
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Control Id="GlobalNavigation" Sequence="100" ControlSrc="~/_controltemplates/mysitetopnavigation.ascx" /> </Elements> |
Inside mysitetopnavigation.ascx, you’ll find the reference to the Find People search control, which is a PeopleSearchBoxEx control:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<SPSWC:PeopleSearchBoxEx ID="MySiteGlobalSearchBox" FrameType="none" HonorUseSiteDefaults="true" IsMysiteSearchBox = "true" DropDownMode="HideScopeDD" ShowSearchOptions="false" GoImageUrl="/_layouts/images/ppl_search_normal.png" GoImageUrlRTL="/_layouts/images/ppl_search_normal_rtl.png" GoImageActiveUrl="/_layouts/images/ppl_search_active.png" GoImageActiveUrlRTL="/_layouts/images/ppl_search_active_rtl.png" QueryPromptString="<%$Resources:sps,MySiteTopNav_PeopleSearch_Text%>" runat="server"/> |
If you want to customize the MySite Host branding and include a normal search box with scope dropdown, you’ll want to use your own master page and include the SearchBoxEx directly. Normally this control is included in the PlaceholderSearchArea, but you can include it manually in your masterpage.
Your first inclination might be to include this control, set UseSiteDropDownMode=”true”, UseSiteDefaults=”true” and then enter your search center url and dropdown settings in the Site Collection Administration > Search Settings page, like so:
1 2 3 4 5 6 7 8 |
" ] <SPSWC:SearchBoxEx id="SearchBox" runat="server" GoImageUrl="/_layouts/images/gosearch.gif" GoImageUrlRTL="/_layouts/images/gosearch.gif" UseSiteDropDownMode="true" DropdownWidth="280" UseSiteDefaults="true" QueryPromptString="<%$ Resources: SearchStrings, SearchFieldText %>" FrameType="None" WebPart="true" __WebPartId="{551E15C2-FF48-4670-BC26-FA1BDD992F74}"/> |
This is what you would typically use on any other site, like a Publishing portal, so that an admin of the site could have some level of control over the search box and scopes. However if you try this, you will notice that the dropdown for scopes will never appear.
The MySite Host is a special beast and is configured to know about the User Profile Service Application settings, so the right way to go about this is to 1) use the default MySite Host Search settings (no scopes, no dropdown, see screenshot above). Then configure your SearchBoxEx like this:
1 2 3 4 5 6 7 8 9 |
" ] <SPSWC:SearchBoxEx id="SearchBox" runat="server" GoImageUrl="/_layouts/images/gosearch.gif" GoImageUrlRTL="/_layouts/images/gosearch.gif" UseSiteDropDownMode="false" DropdownWidth="280" UseSiteDefaults="false" DropDownMode="ShowDD_NoContextual" QueryPromptString="<%$ Resources: SearchStrings, SearchFieldText %>" FrameType="None" WebPart="true" __WebPartId="{551E15C2-FF48-4670-BC26-FA1BDD992F74}"/> |
You can play with the DropDownMode, but personally I like to use ShowDD_NoContextual because the MySite host is not configured to be indexed by the search server, so a contextual scope doesn’t make much sense to offer anyway.