10/6/2009
Here is a list of some custom LDAP filters that can be assigned to your companies People Picker components.
So, now we know what the People Picker is and how to set custom Active Directory search filters, here is a list of LDAP filters that you might find usefull.
Please feel free to add a comment with your own custom filters and I will endeavour to add them to the library above.
----------------------------------------------------------------------
1. Exclude disabled users
Overview
One of the issues with the people picker is that by default it returns all users/groups that match the query including user accounts that have been disabled.
LDAP Query
(!userAccountControl=514)
STSadm Command
stsadm -o setproperty -pn peoplepicker-searchadcustomfilter -url http://moss –pv (!userAccountControl=514)
Source
----------------------------------------------------------------------
2. Search for the user "David"
Overview
To create a custom filter that searches for the user "David" in the Active Directory in the Contoso domain.
LDAP Query
(|(Title=David))
STSAdm Command
stsadm -o setproperty -url http://contoso -pn "peoplepicker-searchadcustomfilter -pv (|(Title=David))
Source
----------------------------------------------------------------------
3. Only return users with a title of Vice President
Overview
create a custom filter which will only return users with a title of Vice President.
LDAP Query
(|(Title=Vice President))
STSAdm Command
Source
----------------------------------------------------------------------
8/27/2009Adding intellisense to Visual Studio for SharePoint based XML files (such as Feature.Xml files) is pretty easy.
Open up the following directory (this is assuming Visual Studio 2008)
C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas\
Add a new file called SharePointCatalog.xml
Add the following XML to that file:
< SchemaCatalog xmlns="http://schemas.microsoft.com/xsd/catalog">
< Schema href="file://c:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/XML/wss.xsd" targetNamespace="http://schemas.microsoft.com/sharepoint/"/>
< Schema href="file://c:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/XML/CamlQuery.xsd" targetNamespace="http://schemas.microsoft.com/sharepoint/"/>
< Schema href="file://c:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/XML/CamlView.xsd" targetNamespace="http://schemas.microsoft.com/sharepoint/"/>
< Schema href="file://c:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/XML/CoreDefinitions.xsd" targetNamespace="http://schemas.microsoft.com/sharepoint/"/>
</ SchemaCatalog>
Save the file and restart Visual Studio. Now you should automatically get SharePoint XML Intellisense. 7/1/2009I have just spent a good couple of days on this problem and have finally come across an answer.
I am programmatically adding web parts to a SharePoint page and didn't want the Toolbar to show up.
Due to a bug in the SharePoint API the following code should, but doesn't, work:
SPView myView = list.Views["View Name"];
myView.Toolbar = "None"; or myView.Toolbar = "Freeform"; or myView.Toolbar = "Standard"; or myView.Toolbar = "Full";
myView.Update();
Unfortunately, the Toolbar poperity of an SPView returns the InnerXml of the Toolbar node and we need to set an attribute on the parent node:
<Toolbar Type="None" /> or <Toolbar Type="Freeform" /> or <Toolbar Type="Standard" /> or <Toolbar Type="Full" />
So, how do we go about setting the toolbar property?
There are a lot of discussions out there on t'Internet, with a number of solutions that worked right up until the Infrastructure Updates were released which broke almost all of them.
The resources I was reading through and trying were:
There are many more, but these are the ones that led me to my final solution.
In the end I came across this post from Jalil Sear.
Original Kudos needs to be sent out to Ton Stegeman and Brian Farhill for this post.
Ok, now that the acknowledgements are out of the way, what was the final solution?
I used the following method from Jalil's blog (its all his code)
public static void SetToolbarType(SPView spView, String toolBarType) { spView.GetType().InvokeMember("EnsureFullBlownXmlDocument", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod, null, spView, null, System.Globalization.CultureInfo.CurrentCulture);
PropertyInfo nodeProp = spView.GetType().GetProperty("Node", BindingFlags.NonPublic | BindingFlags.Instance); XmlNode node = nodeProp.GetValue(spView, null) as XmlNode; XmlNode toolbarNode = node.SelectSingleNode("Toolbar");
if (toolbarNode != null) { toolbarNode.Attributes["Type"].Value = toolBarType;
// If the toolbartype is Freeform (i.e. Summary Toolbar) then we need to manually // add some CAML to get it to work. if (String.Compare(toolBarType, "Freeform", true, System.Globalization.CultureInfo.InvariantCulture) == 0) { string newItemString = ""; XmlAttribute positionNode = toolbarNode.OwnerDocument.CreateAttribute("Position"); positionNode.Value = "After"; toolbarNode.Attributes.Append(positionNode);
switch (spView.ParentList.BaseTemplate) { case SPListTemplateType.Announcements: newItemString = "announcement"; break; case SPListTemplateType.Events: newItemString = "event"; break; case SPListTemplateType.Tasks: newItemString = "task"; break; case SPListTemplateType.DiscussionBoard: newItemString = "discussion"; break; case SPListTemplateType.Links: newItemString = "link"; break; case SPListTemplateType.GenericList: newItemString = "item"; break; case SPListTemplateType.DocumentLibrary: newItemString = "document"; break; default: newItemString = "item"; break; }
if (spView.ParentList.BaseType == SPBaseType.DocumentLibrary) { newItemString = "document"; }
// Add the CAML toolbarNode.InnerXml = @"<IfHasRights><RightsChoices><RightsGroup PermAddListItems=""required"" /></RightsChoices><Then><HTML><![CDATA[ <table width=100% cellpadding=0 cellspacing=0 border=0 > <tr> <td colspan=""2"" class=""ms-partline""><IMG src=""/_layouts/images/blank.gif"" width=1 height=1 alt=""""></td> </tr> <tr> <td class=""ms-addnew"" style=""padding-bottom: 3px""> <img src=""/_layouts/images/rect.gif"" alt=""""> <a class=""ms-addnew"" ID=""idAddNewItem"" href=""]]></HTML><URL Cmd=""New"" /><HTML><![CDATA["" ONCLICK=""javascript:NewItem(']]></HTML><URL Cmd=""New"" /><HTML><![CDATA[', true);javascript:return false;"" target=""_self"">]]></HTML><HTML>Add new " + newItemString + @"</HTML><HTML><![CDATA[</a> </td> </tr> <tr><td><IMG src=""/_layouts/images/blank.gif"" width=1 height=5 alt=""""></td></tr> </table>]]></HTML></Then></IfHasRights>"; }
spView.Update();
} }
Our original code then just has to call extract the WebPart View and call this method:
// Get Webpart View System.Reflection.PropertyInfo ViewProp = wp.GetType().GetProperty("View", BindingFlags.NonPublic | BindingFlags.Instance);
SPView spView = ViewProp.GetValue(wp, null) as SPView;
WebParts.SetToolbarType(spView, "None")
For a little more completeness, here is how I add the ListViewWebPart to the page:
SPView myIssuesView = list.Views["My Issues"];
StringCollection viewFields = new StringCollection(); viewFields.Add("Title"); viewFields.Add("Issue Status"); viewFields.Add("Due Date");
SPView wpView = list.Views.Add("Temp View", viewFields, myIssuesView.Query, 10, false, false, SPViewCollection.SPViewType.Html, false);
ListViewWebPart wp = new ListViewWebPart(); wp.ListName = list.ID.ToString("B").ToUpper(); wp.Title = "My Issues"; wp.ViewGuid = wpView.ID.ToString("B").ToUpper();
wpm.AddWebPart(wp, "LeftMiddleLeft", 1);
list.Views.Delete(wpView.ID);
// Get Webpart View System.Reflection.PropertyInfo ViewProp = wp.GetType().GetProperty("View", BindingFlags.NonPublic | BindingFlags.Instance);
SPView spView = ViewProp.GetValue(wp, null) as SPView;
SetToolbarType(spView, "None");
I hope this goes some way to helping others with this issue. 6/24/2009
This Video has been around for a while, but I do still like it.
Most of the ideas expressed in this video are already here, bu it's a case of bringing it all together and to the mass market.
I, for one, can't wait.
Since I cannot embed videos into a SharePoint blog, here is a link:
Mark 6/19/2009
This content is in the Wiki and will be updated there as more updates are released for WSS3.0 / MOSS 2007
If you need to determine which version of SharePoint you are running, you can do the following:
- Central Administration -> Operations -> Servers In Farm -> Farm Information: Version
- Site Settings -> Modify All Site Settings -> Site Information -> Database Schema Version
These two options give you the Database Schema Version which you can reference against the list below:
|
SP2 |
12.0.0.6421 |
|
Cumulative Update KB956056 & KB956057 |
12.0.0.6327 |
|
Infrastructure Update KB951695 & KB951297 |
12.0.0.6318 |
|
SP1 + KB948945 |
12.0.0.6303 |
|
SP1 + KB941274 |
12.0.0.6301 |
|
SP1 + KB941422 |
12.0.0.6300 |
|
SP1 |
12.0.0.6219 |
|
October 2007 public update |
12.0.0.6039 |
|
August 24, 2007 hotfix |
12.0.0.6036 |
|
RTM |
12.0.0.4518 |
|
Beta 2 |
12.0.0.4017 |
|
Beta 2 TR |
12.0.0.4407 |
|
Office 12 PDC Pre-beta |
12.0.0.311 |
References
6/9/2009
I recently received this query from a colleague and thought the answer would be usefull for others:
Hi Mark,
Could you share with me a print-screen of how a work-flow is configured in SP-2007?
I am wondering to know the level of detail we can set in the system to program a work-flow such as sequential authorizations, parallel authorizations, etc.
Thank you in advance,
A. Colleague
That is a really difficult request to answer. Workflow is so big in SharePoint that there isn’t really a screen shot that can be taken of all the options.
Workflows can be created in SharePoint Designer and there are a initial number of Conditions and Actions that are available, however it is possible to write new Conditions and Actions for use in our workflow, which means what we can do in workflow is limited only to the code that we can write.
When looking at the live Global Collaboration Portal we are not going to be using SharePoint Designer for our workflows (not initially at least) for a number of reasons, but mainly because Workflows created using SharePoint Designer can only be used against the one single list that it is assigned to when created. This makes creating and testing workflows in a development environment very tricky as once the workflow has been tested it needs to be recreated by hand, from scratch in the new next environment along (Local, Dev, UAT, Production, etc) which gives us the risk of human error in recreating them, and no clear path to re-install in a DR environment, let alone reuse in another area of the site.
Later in the life of the Global Collaboration Portal we may allow Power Users to create workflows in this way for small workflows that are only appropriate in that area, with larger workflows being created in Visual Studio.
This brings us nicely onto the preferred approach, which is to create our workflows in Visual Studio. This alleviates many of the issues outlined above, but does carry a higher development cost. Our workflows created in Visual Studio are contained in a Source Control application, can be compiled and deployed to many different environments, and many different lists and document libraries in those environments.
When creating these types of workflow, we start with a blank canvas allowing us to model any process we can imagine (in bother sequential and state-machine workflows) and have the same (including a few other) Conditions and Actions available to us that we had with out SharePoint Designer workflows, and again we can write new Conditions and Actions to cover situations not covered by out-of-the box modules. Regards, Mark Stokes 6/8/2009
I came across an interesting issue recently that only has limited documentation on the web.
I am creating my site templates using the methods descirbed here:
So, using this method, I create a blank Site Definition and 2 Web Templates, one visible and one hidden. I define a WPP (SPWebProvisioningProvider) in the hidden template and that piece of code applies the hidden template and runs some code against that new web to configure it. This keeps us supported so that we don't have to change the Site Definition post deployment to change the site template, we can just update the WPP assembly.
WebtempCustom.xml
< Templates xmlns:ows="Microsoft SharePoint"> <Template Name="FakeCustomTeamSite" ID="10001"> <Configuration ID="0" Title="Team Site" Hidden="False" ImageUrl="../images/stsprev.png" Description="A Custom Team Site" DisplayCategory="Custom" ProvisionAssembly="Custom.SharePoint.SiteTemplates.TeamSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cb281607c9ad5cff" ProvisionClass="Custom.SharePoint.SiteTemplates.TeamSite.WebProvisioningProvider"> </Configuration> </Template> <Template Name="CustomTeamSite" ID="10002"> <Configuration ID="0" Title="Hidden Custom Team Site" Hidden="True" ImageUrl="../images/stsprev.png" Description="A Custom Team Site" DisplayCategory="Custom"> </Configuration> </Template> </Templates>
WebProvisioningProvider.cs
using System; using System.Collections.Generic; using System.Text; using Microsoft.SharePoint;
namespace Custom.SharePoint.SiteTemplates.TeamSite { class WebProvisioningProvider : SPWebProvisioningProvider { public override void Provision(SPWebProvisioningProperties props) { SPWeb web = props.Web; web.ApplyWebTemplate("CUSTOMTEAMSITE#0"); //apply a template to the web web.Description = "Created from a privisioning class."; web.Update(); } } }
Receiver code for Stapled Feature
public override void FeatureActivated(SPFeatureReceiverProperties properties) { using (SPWeb Web = (SPWeb)properties.Feature.Parent) { #region Create Calendar List ExceptionBlock.LogSection("Create Calendar List:");
try { Guid listGuid = Web.Lists.Add("Calendar", "Calendar for team events", SPListTemplateType.Events); SPList list = Web.Lists[listGuid]; list.OnQuickLaunch = true; list.Update(); } catch (Exception ex) {} #endregion } }
Then wanted to not define the features associated with that Site Definition in the onet.xml file, but use Feature Stapling. Again, making my solution more suportable in the future.
A problem I have come across though, is that when I have feature receivers in those stapled features that udate the SPWeb object, it clashes with the web updates in the SPWebProvisioningProvider.
The error message I receive is:
The web being updated was changed by an external process. at Microsoft.SharePoint.Library.SPRequestInternalClass.SetWebProps(String bstrUrl, String bstrTitle, String bstrDescription, UInt32 nLocale, UInt16 nTimeZone, Boolean bTime24, Int16 nCalendarType, Int16 nAdjustHijriDays, Int16 nAltCalendarType, Boolean bShowWeeks, Int16 nFirstWeekOfYear, Int16 nFirstDayOfWeek, Int16 nWorkDays, Int16 nWorkDayStartHour, Int16 nWorkDayEndHour, Int32 lFlags, Int16 nCollation, UInt32 nAuthor, String bstrCustomizedCssFileList, String bstrAlternateCssUrl, String bstrAlternateHeaderUrl, String bstrMasterUrl, String bstrCustomMasterUrl, String bstrSiteLogoUrl, String bstrSiteLogoDescription, Boolean bUpdateTimeCreated, DateTime dtTimeCreated, Boolean bUpdateTimeLastModified, DateTime dtTimeLastModified, UInt32& nCollationLCID) at Microsoft.SharePoint.Library.SPRequest.SetWebProps(String bstrUrl, String bstrTitle, String bstrDescription, UInt32 nLocale, UInt16 nTimeZone, Boolean bTime24, Int16 nCalendarType, Int16 nAdjustHijriDays, Int16 nAltCalendarType, Boolean bShowWeeks, Int16 nFirstWeekOfYear, Int16 nFirstDayOfWeek, Int16 nWorkDays, Int16 nWorkDayStartHour, Int16 nWorkDayEndHour, Int32 lFlags, Int16 nCollation, UInt32 nAuthor, String bstrCustomizedCssFileList, String bstrAlternateCssUrl, String bstrAlternateHeaderUrl, String bstrMasterUrl, String bstrCustomMasterUrl, String bstrSiteLogoUrl, String bstrSiteLogoDescription, Boolean bUpdateTimeCreated, DateTime dtTimeCreated, Boolean bUpdateTimeLastModified, DateTime dtTimeLastModified, UInt32& nCollationLCID)
This appears to be because both pieces of code reference the same SPWeb Object (the contet one?) and cannot update it at the same time. This occurrs because the Stapled Feature Receivers don't know when the web has been provisioned and just run when they are ready.
So, I guess the only way around this is to thread the code, put in some waits to ensure the SPWebProvisioningProvider has completed or create our own SPWeb Objects in all WPPs and Feature Receivers.
I am investigating the solutions now and will update when I have more information.
Mark 5/29/2009This is a very useful tip if you want to create Child Site Collections.
I often use:
etc
with it, hr and finance being it's own site collection. This way I can define quotas and backup / restore procedures on a departmental level.
This post outlines how to create those sub site collections and have them contained in their own Content Databases:
Mark 4/28/2009Very usefull list of fixes here:
Mark. 1/16/2009This is a very good article outling common coding standards for SharePoint.
After experiencing bad code in a project a couple of years ago when SPWeb objects were not properly disposed, we had all manner of memory leaks and server issues. A big code re-write was required which proved expensive and laborious.
Roger Lamb outlines good coding practices that EVERY SharePoint developer should adhere to.
|
|
|
|
|