The SharePoint Knowledge Collection of Cornelius J. van Dyk, an 9 x SharePoint MVP
11 March 2011
SharePoint Versions Table updated for the Feb 2011 CU
I have updated the Versions Table with the latest Feb 2011 Cumulative Update information. The Server 2010 download is not available yet, but the location is correct, so just check back regularly.
Cheers
C
20 February 2011
Now powered by SharePoint Foundation 2010
The ice storm the other day not only knocked out my servers but also caused one of my raid arrays to die and temporarily take this blog down. I decided to pull forward my migration plans for the blog. I had planned to migrate my blog to SharePoint 2010 in the spring, but Icepocalypse 2011 forced me to bring those plans forward.
My blog used to run on an old server (physical hardware) that was 4 years old. I had actually gone through the process of virtualizing it 2 years ago and I had it running on Virtual PC on top of a Window Server 2008 R2 machine at the time. When the raid array died, I was forced to revert to the previous night’s backup of the VM.
Since the 4 year old server died, I had to temporarily host the blog on the next server in the Datacenter. Unfortunately, that was only a single core (Oh my gosh!!!
I’ve since upgraded my datacenter and got a brand spanking new server. The 8 core Intel i7 950 CPU running at 3.7 GHz with 24 GB of RAM and several TB of hard drive space over multiple disks, was humming along nicely. I gave the new blog server 2 dedicated cores and 4 GB of RAM and now the blog is humming along like a top.
Have I mentioned how much I love virtualization lately?
Cheers
C
26 January 2011
SharePoint 2007/2010 Version/Download Table Updated
The SharePoint Version Table has been updated with the Dec 2010 CU version numbers and download links. http://crayveon.com/sharepoint-solutions/sharepoint-versions-list/
Cheers
C
Cheers
C
25 January 2011
How do I – Get A Process ID in C#
Got this question recently… answer is by simply using the System.Diagnostics namespace…
System.Diagnostics.Process.GetProcessesByName("ProcessName")[0].Id;
Cheers
C
18 January 2011
Using the YEAR from a Date column in a calculated column in SharePoint
I got this question from someone on the forums and thought it might be worth reposting to my blog for later reference as well.
The question:
Now this one made me scratch my head for a minute and then I fired up my trusty “Calculated Column Debugger”… Excel!!!Hello – I have an out-of-the box date column titled, “Departure Date” which renders values in the format, ‘DD/MM/YYYY’. I want to be able to filter by Year only so I believe the easiest way to accomplish this is to create a calculated column titled, Year and populate that column with the YYYY values from the Departure Date column. I tried using several formulas but so far have been unsuccessful. I’m currently using this formula, “=TEXT(YEAR([Departure Date]),”YYYY”)” for the calculation value and the value comes up as “1905”…? Help!
USEFUL TIP: ALMOST ANY FORMULA YOU CAN PUT TOGETHER IN EXCEL, YOU CAN COPY TO A SHAREPOINT CALCULATED COLUMN AND IT SHOULD WORK JUST FINE.
I copied the formula over to an Excel cell and put a date in another cell to reference and sure enough… I got 1905 too! Then just looking at the formatting options for the TEXT method and the YEAR method, I was able to deduce the answer thus…
The answer:
The problem is that you’re doubling up on methods by passing the result from YEAR to the TEXT method. Either of the following should work just fine:
- =TEXT([Departure Date], “yyyy”)
- =YEAR([Departure Date])
Because the TEXT method is expecting a DATE value to be passed, but the YEAR method is returning a TEXT value, it confuses the TEXT method which doesn’t know how to interpret the value and thus produces the weird result you saw.
Cheers
C
30 December 2010
SharePoint Check In, Check Out, Content Approval, Draft Item Security and Version History Explained
There seems to be much confusion out in the SharePoint world around the topics of Check In/Out, Content Approval, Version History and Draft Item Security. My goal is to explain and clarify how all these function together.
REQUIRE CHECK OUT, CHECK OUT, CHECK IN
It all starts with the creation of a new document be it created via the New menu or uploaded. When a user creates or uploads the new document, if “Require Check Out” is enabled, SharePoint will check out the document for the user automatically. Nobody, not even Approvers, can see the document until it is checked in.
Approvers can NEVER see content that is NOT checked in!
This is the function of check out and check in. It is a way for a user to work on a document in private until such time they are ready to share the document with others. When they then check it in, it moves to the next level of approval. If a situation unfolds where the user leaves the company and has a document still checked out, an Administrator can either do a “Discard Check Out” or “Take Ownership” can be done followed by a Check In.
This gets tricky in the case of a newly uploaded document. Because Approvers cannot see the document, the user doing the upload needs to be aware of this because they have to do the Check In to allow Approvers to see the document. It’s the same as the first iteration of a New document. Nobody except the author knows that the document actually exists… at least not until Check In.
In cases where users do mass uploads, having the “Force Check Out” option selected on the document library, can cause major problems as the uploading user would have to approve each document individually. That can be a very time consuming process. I always recommend that in such cases, the Administrator temporarily disable the “Force Check Out” option to allow the library content to be populated. With Content Approval turned on, this temporary change, would not cause major issues.
CONTENT APPROVAL
Upon check in, if “Content Approval” is turned on, NOW Approvers as well as the Author can see the document. Normal users cannot see the document until it is approved.
If Content Approval is not turned on, checking in the document, would make it visible to everyone. With Content Approval turned on, an approver would need to review the document and then approve it in order to make it visible to everyone.
DRAFT ITEM SECURITY
When the Draft Item Security option is enabled, it usually deals with a scenario where you may have a collaborative group working on a document. This usually ties in with a Version History setting that has both Major (1.0, 2.0, 3.0 etc.) and Minor (1.1, 1.2, 1.3 etc.) versions. In such a case, there may be a group of people that have Member/Contributor rights that allows them to change document. There are some users who are Approvers and setting this setting determines who of these users can see items AFTER they are checked in. Remember that only the active author can see items that are checked out.
This option is only available when the Version History setting is set to use Minor versions.
VERSION HISTORY
Lastly there is Version History. Version history works independently from the above items with the exception of Draft Item Security which is only available as an option when Version History is set to Minor versions.
When set to Major versions, each update to the document results in a new version e.g. 1.0, 2.0, 3.0 etc.
When set to Minor versions, each update results in a new minor version e.g. 1.1, 1.2, 1.3 etc. When the document is then Approved, a new major version is created. As an example, the document is worked on and checked in by Bob, resulting in version 1.1. Now Sue edits the document and upon check in, it results in version 1.2. This continues until they are ready for the document to be approved. At this point, they choose to Publish a Major version. The document approvers are notified of the submission and they review it. Once they’re happy with it and approve the document, SharePoint publishes the document as version 2.0.
And that is how these items work together in the SharePoint environment. I hope this helps to shed some light on this subject.
Cheers
C
29 December 2010
SharePoint 2010 People Picker de-mystified!
The problem with most demos and classes is that the presenters use straight Active Directory for the configurations and though this most certainly has the desired effect of making the demo run smoothly because everything “just works”, it doesn’t help you and me in the REAL WORLD where more often that not, we encounter a blended environment. If you are fortunate enough to work in a straight AD shop, count your blessings every night!
For the rest of us, we have to make that “blend” work for the customer because at the end of the day, they don’t care, nor should they, about the technical difficulty behind the scenes to make it work… they just want it to work… first time… every time. 
Such is the case when you’re dealing with a Forms Auth/LDAP environment. My client has a huge deployment in SP2007 under LDAP. We deployed SP2010 under Claims Auth which meant a shift away from our old SiteMinder LDAP authentication scheme. Of course, under Forms Auth, we controlled the database against which the authentication and searching was done ala the source against which the PeoplePicker control was searching. Under claims, AD is the source and that adds new technical challenges to the mix in order to ensure that your customer search experience remains the same. Thus my search for information about the PeoplePicker in 2010 began…
There are lots of links out there related to PeoplePicker and custom AD searches. The first and most obvious is this MSDN link that gives us the basic overview. It even provides some basic examples, but it doesn’t actually EXPLAIN how to use it. Joel posted on his old blog on the topic, but it was basically a collection of what’s on MSDN so I was still looking for more detail. There were lots of other posts on the “peoplepicker-searchadcustomquery” switch in STSADM, but they were all either references to the MSDN article or copy and paste jobs. 
In the end, I was left to decipher the problem the old fashion way… through trial and error. After many attempts, I finally managed to get a good read on how it actually works and was able to explain it to my colleagues as well. Now I’m hoping this blog post saves someone some time in the future when they have to work through this. I’ll begin with my Powershell script:
1: clear-host
2: write-host -f green "========================="
3: write-host -f green "========= BEGIN ========="
4: write-host -f green "========================="
5: write-host ""
6: $snapin = "Microsoft.SharePoint.PowerShell"
7: if (get-pssnapin $snapin -ea "silentlycontinue")
8: {
9: write-host -f green "PSsnapin $snapin is loaded"
10: write-host ""
11: }
12: else
13: {
14: if (get-pssnapin $snapin -registered -ea "silentlycontinue")
15: {
16: write-host -f green "PSsnapin $snapin is registered"
17: Add-PSSnapin $snapin
18: write-host -f green "PSsnapin $snapin is loaded"
19: write-host ""
20: }
21: else
22: {
23: write-host -f Red "PSSnapin $snapin not found"
24: write-host ""
25: }
26: }
27: [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
28: $webapps = get-spwebapplication
29: foreach ($webapp in $webapps)
30: {
31: write-host -f yellow $webapp.displayname;
32: write-host -f yellow $webapp.url;
33: stsadm -o setproperty -url $webapp.url -pn peoplepicker-searchadcustomquery -pv "(userPrincipalName={0}*)(givenName=*{0}*)(sn=*{0}*)(displayName=*{0}*))";
34: stsadm -o setproperty -url $webapp.url -pn peoplepicker-searchadforests -pv "domain:<<>>.com";
35: }
36: write-host ""
37: write-host -f green "========================="
38: write-host -f green "========== END =========="
39: write-host -f green "========================="
Lines 12-26 kicks in if the snapin is not already loaded. In this case, it gets the registration info for the snapin and then tries to load the snapin.
Line 27 loads the Microsoft.SharePoint.dll in order to access the SharePoint object model. Line 28 sets a local variable ($webapps) to the return value of the “get-spwebapplication” PowerShell cmdlet.
Lines 29-30 sets up an iteration loop for each object in the $webapps variable. It temporarily sets the current object to another local variable ($webapp) for processing in subsequent lines.
Lines 31-32 writes the Display Name and the URL values of the web application being processed.
Lines 33-34 is where the magic happens. These lines call STSADM and passes the needed values to it in order to set SharePoint’s metadata properties for the people picker.
Line 35 closes the loop.
Lines 36-39 simply writes to closing a closing footer.
Now let’s look at the two STSADM commands in more detail.
stsadm -o setproperty -url $webapp.url -pn peoplepicker-searchadcustomquery -pv "(userPrincipalName={0}*)(givenName=*{0}*)(sn=*{0}*)(displayName=*{0}*))";
The key is the “setproperty” operation in STSADM. Since these properties are stored by SharePoint on a web application basis which is why this command is issued for each web application in SharePoint.
The first switch we provide to the operation is the URL of the web application.
The second switch is the property name and in this case, we’re targeting the “peoplepicker-searchadcustomquery” property.
The third switch is the property value. The value we pass here is the search values that is appended and passed into Active Directory for the search query. This is where the available documentation is lacking. The format to use is as follows:
(<AD Name>=<wildcard>{0}<wildcard>)
where <AD Name> is replace by the Active Directory property name you’re targeting and <wildcard> is replaced by either a star (*) if you want to wildcard on that side of the query or nothing if you don’t want the wildcard on that side.
In our example, we are targeting 4 Active Directory properties. The first is “userPrincipalName” which is the user ID e.g. “cjvandyk@crayveon.com”. In this example, we are using a wildcard at the back of the query so a search such as just using “cjvandyk” or “cjvan” should yield a match.
The second property is “givenName” which is a user’s fist name. We are using front and back wildcards here so any part of the user’s name would yield a match.
The third property is “sn” which is the user’s last name. Again, we’re using front and back wildcards in order to yield a match on any part of the user’s last name.
The last property is “displayName”. This field is populated with the commonly used name of the user. In most cases, a user’s name is registered for a match on the default query passed to Active Directory as “First MI Last” for example, a user would be matched as “Robert E. Doe” within the system. For a user to locate him in a people picker they’d have to use “Robert E. Doe”. In person he may be known as “Bob Doe” instead. A user trying to find Bob in the people picker with “Bob Doe” won’t get a match, but if the Active Directory property for “displayName” is populated with this value i.e. “Bob Doe”, our fourth property would yield a match for the user.
The second STSADM property we are setting for the web application is that of the “peoplepicker-searchadforests”. This is used when you have a very large Active Directory and wish to limit the AD query down to just a specific sub set instead of searching the entire directory. Doing this, can result in some major performance gains in your people picker. The syntax is:
stsadm -o setproperty -url $webapp.url -pn peoplepicker-searchadforests -pv "domain:<<<CHANGEME>>>.com";
As before, our first switch passed is the URL of the target web application.
The second switch is again the property name which as we’ve already mentioned is “peoplepicker-searchadforests”.
The third switch is the property value. In this switch, simply replace the “<<<CHANGEME>>>” with your target domain you wish to limit the search to.
The last thing you need to do, is ensure that your Active Directory team configure indexes on all the properties that you have specified in your search query. Having indexes on these properties within AD will also give you a good boost in the performance of the people picker control.
Provided that your AD is populated correctly, using this script, you can configure the people picker for optimal results for the end user. For your convenience, you can download the PowerShell script from my downloads library located here:
Cheers
C
Subscribe to:
Posts (Atom)
SharePoint Remote Event Receivers are DEAD!!!
Well, the time has finally come. It was evident when Microsoft started pushing everyone to WebHooks, but this FAQ and related announcement...
-
Ever wondered what the new SharePoint Online URLs are all about? Take for example https://cjvandyk.sharepoint.us/:x:/r/sites/Site1... What ...
-
Have you ever started creating a list view in SharePoint and because you're experimenting, you chose to make it a "Private" vi...
-
The Microsoft Authentication Library (MSAL) is a powerful library designed to simplify the authentication process for applications that conn...