Archive for 'SharePoint'
AllowUnsafeUpdates Error Updating User Profile Information
Posted on 10. Nov, 2011 by bryan.
My customer has a requirement to track the last login date/time for each SharePoint user so that they can disable accounts that have not had any activity for a time period. I decided to implement this requirement by creating an HttpHandler and tying a jQuery .post call into the custom masterpage. The HttpHandler would then update a property, LastLogin, that has been added to the user profile service application.
The issue I ran into is that SharePoint would constantly complain about not allowing updates via a GET, and that I needed to set the AllowUnsafeUpdates property on the SPWeb object. Sounds simple and straight forward enough, and oddly this was an instance where not only did SharePoint give you a decent error, it even went so far as to propose a solution! Double word score! Unfortunately it took forever to figure out WHICH SPWeb object it was talking about! Check out the following code:
private void UpdateUserLastLogin(HttpContext context)
{
string siteURL = SPContext.Current.Site.Url;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(SPContext.Current.Site.ID))
using (SPWeb web = site.OpenWeb(SPContext.Current.Web.ID))
{
// this is the important bit
SPContext.Current.Site.AllowUnsafeUpdates = true;
SPContext.Current.Web.AllowUnsafeUpdates = true;
SPServiceContext serviceContext = SPServiceContext.GetContext(site);
UserProfileManager profileManager = new UserProfileManager(serviceContext);
UserProfile profile;
if (!profileManager.UserExists(SPContext.Current.Web.CurrentUser.LoginName))
{
profile = profileManager.CreateUserProfile(SPContext.Current.Web.CurrentUser.LoginName);
}
else
{
profile = profileManager.GetUserProfile(SPContext.Current.Web.CurrentUser.LoginName);
}
profile["LastLogin"].Value = DateTime.Now;
profile.Commit();
SPContext.Current.Web.AllowUnsafeUpdates = false;
SPContext.Current.Site.AllowUnsafeUpdates = false;
}
});
}
So if you look at the part commented “This is the important bit” you will see AllowUnsafeUpdates getting set. This is what I finally came to which actually worked. Previously I tried the following:
site.AllowUnsafeUpdates = true; web.AllowUnsafeUpdates = true;
And that did not work at all. So I’m still not completely clear why setting it on the SPContext.Current.Web works, considering that I am spinning up new instances of SPSite and SPWeb and sending them to UserProfileManager, but whatever. I’ll take it.
If anyone can explain why this works that would be awesome, in the meantime I’ll keep this handy incase I run across this dreaded error in the future.
Continue Reading
XSL for Displaying Raw XML in XsltListViewWebPart
Posted on 31. Oct, 2011 by admin.
I am writing this post so that I can hopefully save myself time in the future from trying to track down this little snippet that will take the incoming XML to an XsltListViewWebPart and render it out. This is the snippet:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <xmp><xsl:copy-of select="*"/></xmp> </xsl:template> </xsl:stylesheet>
This snippet comes from a community content comment on MSDN: http://msdn.microsoft.com/en-us/library/ff602042.aspx.
Continue Reading
Use A Records for SharePoint Sites When Using Kerberos
Posted on 12. Jul, 2011 by admin.
When given the choice between using an A DNS record or a CNAME DNS record for your SharePoint web applications, favor an A record particularly if you are using Kerberos authentication. Reference the following TechNet article:
http://technet.microsoft.com/en-us/library/gg502606.aspx
Of particular interest in this article is the following passage:
Kerberos authentication and DNS CNAMEs
There is a known issue with some Kerberos clients (Internet Explorer 7 and 8 included) that attempt to authenticate with Kerberos enabled services that are configured to resolve using DNS CNAMEs instead of A Records. The root of the problem is the client does not correctly form the SPN in the TGS request by creating it using the host name (A Record) instead of the alias name (CNAME).
Example:
A Record: wfe01.contoso.com
CNAME: intranet.contoso.com (aliases wfe01.contoso.com)
If the client attempts to authenticate with http://intranet.contoso.com, the client does not correctly form the SPN and requests a Kerberos ticket for http/wfe01.contoso.com instead of http/intranet.contoso.com
Details regarding the issue can be found in the following articles:
http://support.microsoft.com/kb/911149/en-us
http://support.microsoft.com/kb/938305/en-us
To work around this issue, configure Kerberos enabled services using DNS A records instead of CNAME aliases. The hotfix mentioned in KB article will correct this issue for Internet Explorer but will not correct the issue for the .NET framework (which is used by Microsoft Office SharePoint Server for web service communication).
What me and my team experienced is that a customer had a customization which interfaced with Exchange. The browser authentication to the web application appeared to be working fine, but the double-hop to Exchange was failing with a 401 error. All SPNs appeared to be correct. We changed the DNS records from CNAME records to A records and the authentication began to work as expected.
Continue Reading
Couple “Gotchas” with Console Applications and SharePoint 2010
Posted on 12. Jul, 2011 by admin.
Wrote a console application today that synchronizes a SQL database with task information from a SharePoint farm as part of a task aggregation solution for a client. Came across two small “issues” with Visual Studio 2010/SharePoint 2010 and console applications. I am primarily writing this to remind myself later, but perhaps it will help someone else as well.
First “gotcha”: Make sure you set the target .NET Framework to 3.5. By default Visual Studio 2010 is going to select 4.0 and it will then do a bunch of complaining about not finding Microsoft.SharePoint.dll. Yes, the compiler will give a pretty detailed error which may or may not reference the fact that you need to target 3.5, but it had me scratching my head for awhile so I figure its worth capturing.
Second “gotcha”: You need to target x64 platform. I was getting all kinds of crazy behavior when targeting x86. When I would try to create SPSite objects I would get “FileNotFound”. If I would try to use SPWebService.Locate I would get permissions issues. Switch the platform to x64 and everything started working like magic!
That’s it, hope this saves someone some time (preferably me on a later project
).
Continue Reading
Programmatically Changing the Show and Hide Ribbon Navigation Setting
Posted on 15. Jun, 2011 by bryan.
Much like everything I blog about, I had a requirement from a customer to programmatically set the “Show and Hide Ribbon” setting that is seen within the Navigation configuration page off of Site Settings (a.k.a. the _layouts/AreaNavigationSettings.aspx page). I looked all through the SPWeb.Navigation options and the PublishingWeb.Navigation options and couldn’t find it. Then I remembered the oldest trick in the book, decompiling SharePoint! I brought up the Microsoft.SharePoint.Publishing.dll in Telerik JustDecompile and found the codebehind implementation for the page. Once there it was easy to figure out how to make the change. Fast-forward, here it is:
SPWeb web = null; // works better if you actually set this to a valid instance // so this property, the __DisplayShowHideRibbonActionId, doesn't exist unless it's set to No! // so in this instance we are setting it to No, but if you want to set it to Yes you just // want to clear the value for the property. make it string.Empty, or just delete the // property entirely. web.AllProperties["__DisplayShowHideRibbonActionId"] = "False"; // Update your web, do a jig. web.Update();
Continue Reading
Programmatically Add ListViewWebPart with Customized View
Posted on 15. Jun, 2011 by bryan.
There are several approaches to adding a ListViewWebPart to a page floating around the Interwebs, and I do believe over the course of the past week I have tried every one of them! What I intend to do here is to cut to the chase and present the method that worked reliably for my purposes.
Scenario
As the title suggests, the scenario is that we are adding a ListViewWebPart to a page, utilizing one of the current list views as a “template”, but making some changes for the purposes of this web part.
Solution
I recommend hitting the “view source” button on the syntax highlighter, I really need to switch to a wider blog template
. In any event, here is the solution that I employed, I added numerous comments to describe why things were being done. Hopefully it saves someone some time.
SPLimitedWebPartManager limitedWebPartManager = null;
ListViewWebPart wp = null;
try
{
// assume that you have a limitedWebPartManager variable containing an
// instance of a SPLimitedWebPartManager class.
// also assume that you have a list variable containing a reference to the
// SPList that you are pointing this ListViewWebPart at.
// create an instance of the ListViewWebPart
wp = new ListViewWebPart();
// convert the list GUID to a string, must include braces (ToString("B")) and be in uppers (ToUpper())
wp.ListName = list.ID.ToString("B").ToUpper();
// optionally set the title of the web part
wp.Title = "I Love List Views";
// add the web part to the limited web part manager. when you do this, a "hidden" view will be created
// on the list referenced by the list variable. we will later get a reference to this hidden view and bend it
// to our will.
limitedWebPartManager.AddWebPart(wp, "whatever web part zone you want to add it to", 1); // the 1 is the index within the zone
// you need to update the list because a view was just added to it
list.Update();
// now that the web part has been added we need to get a fresh reference to it from the limitedWebPartManager.
// there are plenty of great ways to do this, in this example i will be using the low-tech approach of enumerating the
// WebParts collection and checking for the type and title that matches our part. i am quite positive there are more
// efficient ways of doing this, but this code gets called exactly once every couple months, so efficiency isn't worth
// the extra development cycles
foreach (System.Web.UI.WebControls.WebParts.WebPart webPart in limitedWebPartManager.WebParts)
{
// check to see if the type of the web part is ListViewWebPart, and if so, check if the title matches our guy.
if (webPart is ListViewWebPart &amp;&amp; webPart.Title.Equals("I Love List Views"))
{
// cast the web part to a ListViewWebPart so we can start to tweak its properties
var listViewWebPart = webPart as ListViewWebPart;
// here is some of the magic. the web part now has its ViewGuid property populated which
// contains the Guid of the hidden view. we get a reference to it here.
var view = list.Views[new Guid(listViewWebPart.ViewGuid)];
// here we grab a reference to a template view. this may be the default view of the list,
// or maybe you have another view that you created that you want to use. you don't have to
// do this, but in this scenario i wanted to copy the filter and sort settings from an existing view.
var templateView = list.Views["Name Of Template View"];
// now we drop all of the view fields in the hidden view
view.ViewFields.DeleteAll();
// now we are going to go through a string array and add each of the strings to the view fields collection. again,
// you don't have to do this, but if you want to change what columns are displayed in your ListViewWebPart, you will
// need to muck with the ViewFields of the view.
Array.ForEach(new string[] { "First Name", "Last Name", "Address" }, f => view.ViewFields.Add(f));
// here we copy the Query straight from the templateView. if you didn't have a templateView you could always
// just create an SPQuery instance and assign it to the view.Query property. no points will be taken off for doing that.
view.Query = templateView.Query;
// update our hidden view, and bask in the awesomeness of our customized ListViewWebPart
view.Update();
}
}
}
finally
{
// do some fun cleanup of disposable items. if you are wondering about the .Web.Dispose() bit look for my
// blog article on the memory leaks in the SPLimitedWebPartManager.
if (limitedWebPartManager != null)
{
if (limitedWebPartManager.Web != null)
{
limitedWebPartManager.Web.Dispose();
}
limitedWebPartManager.Dispose();
}
if (wp != null)
{
wp.Dispose();
}
// i probably missed some .Dispose()s since I cobbled this code together in WordPress and not Visual Studio
}
}
Continue Reading
Tech Ed 2011 Summary
Posted on 20. May, 2011 by bryan.
Sitting in the Atlanta airport waiting for my flight home seems as good a time as any to summarize what I learned this week at Tech Ed 2011 in Atlanta.
First, this is the second year in a row that I have used my iPad at Tech Ed for note taking. Last year I used Apple’s Pages app to take notes, and that worked reasonably well. During the keynote this year I searched for other options and came across iThoughts HD. This is a mind mapping app similar to Freemind or XMind on the PC. This app worked incredibly well for me taking notes, as often the presentations would bounce back and forth between topics and the ability to simply tap on the nodes within the mind map felt very natural and productive. In addition, the app allows you to export in a number of formats, two of which being Freemind and Xmind, so I will be able to send my maps to the PC and edit them in one of those programs.
While the iThoughts HD app was great, you could do the same thing on the PC using the previously mentioned Freemind or Xmind apps. Where the iPad really shines however is the fact that you can go ALL DAY taking notes, browsing the web, tweeting, etc. without ever having to look for an electric outlet! If you have been to Tech Ed, you no doubt understand how difficult it can be to find electric outlets to charge your laptop. In a sea of 10,000 attendees, electric outlets are precious resources.
Okay, enough about how great the iPad is, on to what I actually learned!
Virtualizing SharePoint
Virtualizing SharePoint was a good session, although it didn’t necessarily provide a bevy of new information, it at least validated things I believed to be true. Couple of key points:
- SharePoint and virtualization go together like peanut butter and jelly. If someone tries to tell you otherwise, smack them and their momma. Yes, SharePoint is resource intensive, so no, don’t build your hyper-v cluster on 386SXs. Use the latest server hardware technologies available, use the latest hypervisor offerings from Microsoft and VMware, use Windows Server 2008 R2 guests, and be happy.
- Certain SharePoint roles are absolute slam-dunks for virtualization, other roles require further consideration. Web front ends, query, and app roles are all ideal candidates for virtualization. What makes something an ideal candidate for virtualization? Really it comes down to how resource intense the role is. In a SharePoint farm, the aforementioned roles happen to be the lighter roles within the farm. This leaves your index/crawl roles and your SQL roles up for debate. Whether or not you choose to virtualize your SQL servers is greatly influenced by how large/active of a farm you have, and how important the benefits of virtualization are.
- Fixed-size VHDs and direct-attached LUNs are very close in performance. Do NOT use dynamically sizing VHDs. You can think about it, but DON’T DO IT. Where disk performance is of utmost importance, *hem hem* SQL server *hem hem*, send the LUN straight to the VM. Where it is not as critical, like in a web front end or app server role, using a fixed-size VHD gives some flexibility in terms of moving the VHD around, and the performance impact is negligible.
- This doesn’t apply to just virtualization scenarios, but ALWAYS, ALWAYS, ALWAYS define a SQL alias and point SharePoint at the alias, otherwise you can not move your SQL instance housing the SharePoint config database.
- Okay, I don’t fully get this one just yet, so I need to do more research, but apparently allocating memory that causes the VM to cross NUMA boundaries is a V.ery B.ad T.hing. In simple terms I understood what was being said, take the amount of RAM of the host machine and divide it by the number of cores, and that is your NUMA window size. Then multiply that size by the number of CPUs assigned to the guest and do not exceed that, but as I understand it that is an oversimplification. Crossing NUMA boundaries allegedly leads to a performance hit of 30% or more.
- For any disk intense guests make sure the RAID configuration for the VHD or the RAID configuration for the LUN is RAID 10. This ensures the greatest write performance.
- Reverting to VM snapshots is NOT supported by Microsoft.
- Combine SQL Mirroring with HyperV/Vsphere clustering and you have a robust high availability solution.
- Do not put your SQL guest and your web front end on the same physical host.
Cross-Farm SharePoint Services
This session was really heavy on the PowerShell needed to implement cross-farm services, which I didn’t find to be tremendously useful. The PowerShell was not up long enough for someone to transcribe it, and you are not going to commit it to memory in the short amount of time it is being displayed, so I would have preferred more discussion around the concepts and techniques being used instead of just showing code. In any event, I did pickup a few things from this session:
- Cross-farm shared services are synonymous with federated services.
- Cross-farm shared services can be in different domains.
- Writing PowerShell scripts to create/configure your farms makes for better disaster recovery documentation than “click here, click here” documentation.
- Cross-farm shared services are not compatible with Office 365.
- The load balancer that SharePoint has out-of-the-box for service applications does simple round robin load balancing, it does not perform health checks of the services.
- Regardless of the authentication type for the web application, behind the scenes SharePoint is using claims authentication.
- When troubleshooting issues with federated services, ensure that the consumer has permissions to the Topology Service.
Building IT Dashboards with Visio Services
Picked up a few tidbits here; I hadn’t previously seen any demos of Visio Services or had an opportunity to play with it myself, so just seeing it being used was interesting. Here are the highlights:
- Visio Data Graphics allow you to overlay shapes with an icon based on a rule. Think Excel Conditional Formatting rules. Very cool.
- When you save your Visio Diagram, make sure to save as a “Web Drawing”
- Visio Services provides a “read-only” view of the diagram.
- Visio Services renders using a Silverlight web part, but can degrade to a raster form of the diagram if Silverlight is not available on the client.
- Visio Services can use the following data sources: Excel Services, SQL, OLE DB, ODBC, Custom, SharePoint List. It cannot use External Lists/BCS or Analysis Services.
- Visio Services is a component of the SharePoint Enterprise SKU.
- Visio 2010 Premium contains a SharePoint Workflow template.
- You can use web part connections to connect a Visio Diagram to an InfoPath Form web part as an example. If you want to connect multiple data columns you need to use SharePoint Designer as the web interface only allows you to connect a single data field between the two web parts.
- Visio Web Services ships with an extensive JavaScript library. It is preferable to use this library to connect web parts as opposed to using web part connections because web part connections cause post backs.
- When defining a workflow in SharePoint Designer, if you select “Show Workflow Visualization on Status Page” check box, SharePoint will render a Visio Services view of the workflow and overlay the status of each workflow action.
SharePoint and Silverlight
The SharePoint and Silverlight session was very code heavy, which wasn’t incredibly valuable to me. Not that I have anything against code, obviously I do not, but I wasn’t going to be committing to memory hundreds of lines of code over a 1.5 hour period. Still, I was able to pick up on some key concepts which made the session worthwhile. First, the session validated my belief that Silverlight would prove to be a great technology moving forward with SharePoint as SharePoint portals become more and more locked down. In other words, instead of deploying customizations that are server side, many client requirements can be handled through JavaScript or Silverlight and not require either sandbox solutions or farm solutions. Here are a couple of key points I heard:
- Search for and install the Silverlight SharePoint extensions for Visual Studio. They make it simple to incorporate your Silverlight into a SharePoint page for development.
- Silverlight has a technology called HTML bridging which allows the Silverlight application to modify HTML within the hosting page. This was demonstrated by defining a ‘div’ on a page and then clicking a shape in the Silverlight app which subsequently added text to the div. Pretty cool.
- The DataServiceQuery class can/should be used to query SharePoint OData services.
- Silverlight is able to take advantage of the rich SharePoint 2010 client object model, including the LimitedWebPartManager class.
- There is an issue with older ASMX web services which causes them to be incompatible with Silverlight. As a workaround, a endpoint behavior has been developed and open sourced that will adapt the data types from the legacy ASMX web service to the data types expected by Silverlight.
Writing SharePoint Service Applications
This was another session that was really deep on implementation code. I’m sorry, but I lose interest pretty quick in a session like this; really the slide deck becomes more important than what the speaker is saying. It was useful though to get a feeling for the complexity level of writing a SharePoint custom service application. Simply put – it’s a very high complexity level!
- In most instances, write a web service, not a service application.
- Write a service application when you want a unified management interface through Central Administration, want to take advantage of SharePoint’s backup and recovery features, want to take advantage of SharePoint’s round-robin load balancing.
- Creating a service application involves implementing a minimum of 5 classes. Best to just go here http://bit.ly/giiGhb and read up on it.
NuGet in the Enterprise
I’ve seen NuGet popping up everywhere lately, and was very interested in this session to learn more about its applications in an enterprise environment. If you are not familiar with NuGet, read up here http://bit.ly/mqgRvV. In a nutshell, NuGet facilitates incorporating dependencies into your projects. If you know anything about Java, think Maven repo. Where it is different however is that it is not involved in your build like Maven is, but it does make it simpler to incorporate dependencies into your project and to upgrade dependencies within your projects.
Okay, so how about the “Enterprise” part? What is great about NuGet is that while it is perfectly viable for you to go out and install packages from the public NuGet gallery, in most enterprise development scenarios you will want to have more control over what packages are being incorporated into projects. NuGet provides the ability to stand up an enterprise NuGet server, either as just a simple “head-less” server or a rich, Orchard-driven gallery. With this you can provide the ability to browse the NuGet gallery through a rich web interface.
It is important to note that while there is a NuGet Visual Studio extension, NuGet works perfectly well on a clean build server, and Jetbrains is working to incorporate the ability to integrate NuGet into TeamCity. This is great news as many organizations will want the ability to build dependency packages within TeamCity and then publish those packages to the enterprise NuGet server. You can accomplish this today using the command-line in your build definitions, but making TeamCity NuGet aware will facilitate integration quite a bit.
NuGet = good. I will definitely be adding setting up a NuGet server to my list of things to do at the office.
Claims Identity and SharePoint
I will freely admit that I had next to no knowledge of Claims-based Authentication coming into this session. I knew it was a radio-button I could select when provisioning a web application, and I knew that I didn’t want to use it, instead I wanted classic authentication. That should have been my first clue that I had some homework to do. Career tip – If you are presented with two options, one saying “classic” and one saying something else, learn what that other option means or risk extinction! Classic cars are cool, classic* in technology is un-cool.
There was a great analogy shared during this session with regard to what “claims-based” authentication means. The presenter, and I apologize I didn’t take notes on who the presenter was, but in any event, the presenter said that on his Facebook page his hometown is listed as Chicago. Now, he actually lives outside of Chicago in a suburb. The fact this his Facebook page says his hometown is Chicago does not give him the ability to vote in Chicago elections because the Chicago board of elections does not trust Facebook as a claims provider. Instead, the board of elections trusts the motor vehicle administration, and his driver’s license has his actual home address.
What this analogy means is essentially you can setup SharePoint to trust the claims of other providers, whether they be consumer identity providers like Google or Live, external partners, etc. Very powerful stuff which could definitely impact the way that extranets are architected and implemented.
Couple of key bullets:
- Claims are SAML-based. While Active Directory Federation Services are likely to be the most common claims identity providers, any identity provider issuing a SAML-based claim is compatible.
- Claims authentication is based on Windows Identity Foundation.
- Additional information about claims authentication in general is available here http://bit.ly/3G30GP.
- SharePoint 2010 allows multiple authentication methods to be defined for a single zone.
- Trusted identity token issuer is added through PowerShell (most claims authentication management is done through PowerShell)
- SelfSTS is a utility that makes it easy to develop/debug claims authentication.
- SharePoint does not use the operating systems certificate store. Certificates that are loaded into SharePoint are actually stored in SQL so that they apply farm-wide.
- Claims authentication impacts the behavior of the people picker. Essentially, SharePoint does not know who is on the other side of the fence providing claims. So if you wanted to say “Johnny Appleseed” from “ABC Corp” can access a given site, you would say in the people picker, “Any claim coming in where the e-mail address is jappleseed@abcorp.com can access”. You cannot validate that “jappleseed@abccorp.com” is the correct e-mail address. It is possible that through setting up a user profile crawl of an external LDAP server you may be able to get around this. Need to do some research on that.
Automating Business Processes Using SharePoint, InfoPath Forms Services, and Word Services
This will likely not come as a surprise to many, but in my experience people are really embracing SharePoint for business process automation. This isn’t necessary one of the features that I see widely touted about SharePoint, but InfoPath Forms Services and SharePoint’s out of box workflow support just begs for business process automation. Gone are the days of writing departmental ASP.NET web apps for anything and everything (sniff, sniff). This session had some great best practices for automating business processes in SharePoint.
- As mentioned previously, this session also really pushed using sandbox solutions and the client-side object model. With Silverlight and JQuery we can finally truly push presentation out to the browser and not have this mix-match of services and presentation on the server. Several sessions all highly recommended sandbox solutions, and to target solutions for Office365 compatibility regardless of whether or not you are actually deploying to the cloud. This will ensure the least painful (read costly) upgrades and maintenance.
- Follow application lifecycle management even for out-of-the-box SharePoint business process automation. What does this mean? It means defining your process before implementing it. Implementing the process in a non-production environment before moving to production. Considering versioning impact on the process.
- I wholeheartedly agree with this one – when using business connectivity services, never connect directly to a SQL database. Implement a web service and connect BCS to the web service. This gives you the ability to enforce any business rules that may be required if write is enabled through BCS, logging, abstraction of the data layer incase things move around, etc. Preferably you already have a service layer in front of the SQL database and can simply connect to that, but if you do not, go ahead and write one!
- Never use “Revert to self” authentication for BCS. Revert to self uses the application pool identity of the web application to authenticate to the backend service. It is much more secure to use passthrough authentication (the callers identity passes through to the backend system) or use secure store service to map the user to a credential for the backend system.
- Stay away from external list lookup columns. If you implement these the data gets cached and whatever data the user who created the lookup column had rights to gets presented to everyone. In other words, if Joe creates the lookup column and he has access to all rows in the table, but Ben is supposed to only see half of the rows, Ben will end up seeing all rows in the lookup column. One workaround for this is to use InfoPath forms and use a secondary data connection to populate a drop-down instead of using a lookup column type.
- I didn’t realize there is an OpenXML SDK that can be used to generate a class for writing Word documents (http://bit.ly/iYPgEg).
- As with other customizations in SharePoint, workflows should first be done using out of the box features. If out of the box features cannot meet the business requirements then reusable custom activities should be employed. As an absolute last resort create a custom workflow in Visual Studio.
Cross Organization Collaboration Using SharePoint Claims Authentication
Whew, this post is running a lot longer than I was expecting! Must …. Keep …. Typing!
Anyway, this session was pretty similar to the earlier session on setting up claims authentication, but there were a few tidbits I picked up that weren’t in the other session:
- Office 2010 applications fully support claims-based authentication. Office 2007 applications have some “gotchas”. What those “gotchas” are were not explained, so I’ll have to do some research on this.
- Claims authentication enables SharePoint to use “consumer” ids like Facebook, Google, Live, etc. The best practice when using consumer ids is to create a local unique identifier for the account and map the identifier to the consumer id. This provides some flexibility in terms of being able to switch the consumer ID that is used for an account without it changing the underlying profile.
SQL Server “Denali” Reporting Improvements
So, SQL Server “Denali” will be coming out soon as a CTP, and man oh man, after seeing the improvements being made to reporting services and its SharePoint integration, I cannot wait! Here are some of the highlights I heard:
- Native SharePoint service application integration. No more bubblegum and duct tape integration, reporting services will be a first class SharePoint service application. Microsoft is indicating performance improvements of 30-60% over SQL Server 2008 R2 SharePoint integrated mode. In addition, configuration will be managed through Central Administration and logging will be through ULS.
- Self-service alerting. Users will be able to setup alerts based on data contained in reports. Very cool stuff.
- Ability to export as Open XML file formats. Still no PowerPoint support, but a step in the right direction.
- One of the coolest things I saw was “Project Crescent”. Think Report Builder meets Silverlight. The intention is to enable end users to create their own reports right in the SharePoint portal using a Silverlight client and SQL Server Analysis Services integration. The demo was incredibly impressive, can’t wait to kick the tires when the CTP comes out.
Alright, this is the part of the program where I start to get lazy
. I attended another 5 sessions, but each of the sessions did not really have enough for me to start a whole new section here. So, here is what I propose. I’m just going to bullet out the couple random things picked up from each session in one list. It’s not all that much, so it should be fairly easy to follow. Let’s give it a try, and see what happens, shall we?
- MVC 3 supports HTML5 markup.
- With MvcScaffolding you can add your validation rules to your POCO classes and the scaffolding will generate the appropriate DB and web validation.
- Entity Framework 4.1 supports code first! Hooray!
- Web forms is getting into the scaffolding scene also. WebFormsScaffolding. Does anyone still care about web forms? Please Microsoft, next rev of SharePoint kick web forms to the curb so we can all put web forms out to pasture and wash the stink from ourselves.
- IISExpress enables you to have a nice lightweight usermode IIS that supports SSL.
- You can do HTML5 in SharePoint! Make sure to remove the “meta” tag that says IE-Compat-8. Just get rid of it.
- Couple ways of loading jQuery into SharePoint: Script link, Sys.loadScripts, Custom Action ScriptLink.
- Wasn’t aware of the following JavaScript function: _spBodyOnLoadFunctionNames.push() allows you to put something into the body onLoad from a content editor web part.
- Couple other cool bits of JavaScript: SP.UI.Notify and SP.UI.Status give you the ability to do the cool yellow notifications or red status alerts in SharePoint. SP.UI.ModalDialog is used to pop up a modal (duh).
- Wasn’t aware of Randy Drisgill’s starter master page for 2010: http://bit.ly/cfuPTK.
Holy cow, I actually do not have any more notes! So that was basically my week at TechEd. I also worked in the 70-667 (SharePoint 2010 Configuration) exam and some time in the Exhibit Hall talking to various SharePoint component vendors. Lots and lots of follow-on research to do, can’t wait!
Continue Reading
Unable to access trusted domain accounts in people picker
Posted on 30. Aug, 2010 by bryan.
For several weeks we have been wrestling with an issue where a client’s MOSS install was not able to see the accounts in a trusted domain (two way trust). The server itself could resolve the accounts just fine, for instance if you were to set file system ACL permissions you could select accounts from the trusted domain without any issue, but if you tried to locate one of those accounts via the SharePoint people picker dialog, it would not locate the account. Netmon captures revealed that the lookup was making it to the DC and the response was a populated as you would expect, but still, no workie. Several stsadm.exe -o setproperty commands later and several server rebuilds, still no luck.
Finally today my colleague Stephen Rea was able to locate the issue and resolve it. As is often the case, seemingly complex issues turn out to be caused by very simple oversights. In this case, the trusted domain had been setup in DNS for the resource domain as a secondary domain. Secondary domains hosted on Windows DNS servers going across a WAN link typically perform erratically. Simply forwarding the DNS requests for the trusted domain over to the trusted domain DNS servers resolved the issue and SharePoint immediately behaved as expected.
Continue Reading
User Profile Import Stuck
Posted on 26. Jan, 2010 by bryan.
A client had an issue today with user profile imports being “stuck”. In one instance (the production instance) the profile import was stuck actually performing the import, in the non-production instance it was stuck on “Enumerating”. Found a great article by Henrik Andersson to fix the issue. Here is what he posted as the fix:
Open the registry editor. Browse to “HKEY_LOCAL_MACHINESOFTWAREMicrosoftOffice Server12.0SearchApplications”. Here you will find a key for each SSP in the farm. Drill down to "GatherProfileImportContentSources " (which is the Full Import) and check the key “CrawlNumberInProgress”. If it´s not “0xffffffff” then the number displayed corresponds to a key under the branch “HKEY_LOCAL_MACHINESOFTWAREMicrosoftOffice Server12.0SearchApplications\GatherProfileImportCrawls”.
I changed the number in the key “CrawlNumberInProgress” to “0xffffffff” and then restarted the “Office SharePoint Server Search” service for the settings to be applied.
Continue Reading
Migrating Subsites to New Site Collections
Posted on 23. Sep, 2009 by bryan.
I am currently working on a project to split up a single site collection to multiple site collections. There are multiple reasons for doing so, and there are useful blog posts dedicated to the topic of whether to use multiple site collections or subsites. In this instance, the primary driver for using multiple site collections is to get the desired scoping functionality the customer would like for Nintex Reporting 2008.
Tackling the job of migrating from subsites to new site collections is no trivial task. There are however, some COTS products specifically tailored to this case:
Unfortunately, I did not have the luxury of using one of these purpose-built tools for this endeavor. Instead, I have relied on Gary Lapointe’s fantastic stsadm extensions. Specifically, the following:
- gl-convertsubsitetositecollection – this one does all of the heavy lifting, using the SharePoint Content Migration API.
- gl-replacewebpartcontent – this allows you to use regex patterns to search and replace links that are in content editor web parts
- gl-copynavigation – because the new site collections create their own global navigation, I set the global navigation of the root (/) site collection to be all manual links, and use this extension operation to copy that navigation to the new site collection
- gl-addsiteadmin – add site collection administrators to the site collections easily
These commands have been grouped into a batch file which will handle each step of the migration process. This has worked pretty well. The batch file is executed through a Scheduled Task as the process often can exceed 24 hours in runtime so executing through RDP is not an option.
The last utility I have made use of for this effort is bmail from Beyond Logic. This is a simple command-line SMTP mailer which is used at the end of the conversion batch file to notify me that the process is complete. This saves me the trouble of having to login to the server several times a day to check on progress.
Have I missed any utilities that you find useful for similar work? If so, please comment!

