I got this error whilst trying to get User Profiles to work. Things to check:
- Domain name is correct
- If using custom sources, try creating a new custom source and deleting the old one
I got this error whilst trying to get User Profiles to work. Things to check:
Posted in bugs, sharepoint | Tagged bug, sharepoint, userprofiles | Leave a Comment »
I was getting this error message in Visual Studio 2008 when adding a custom activity to an existing workflow.
Solution
This worked for me, your mileage, may and probably will vary.
It was necessary for me to un-gac the workflow project, then the custom activities could be added to the design surface as expected.
Posted in sharepoint, workflow | Tagged activity, bug, custom activity, custom workflow, sharepoint, workflow | 6 Comments »
Ever get any of these errors?
The DataSourceID of ‘TopNavigationMenu’ must be the ID of a control of type IHierarchicalDataSource. A control with ID ‘topSiteMap’ could not be found. at System.Web.UI.WebControls.HierarchicalDataBoundControl.GetDataSource()
at System.Web.UI.WebControls.HierarchicalDataBoundControl.ConnectToHierarchicalDataSource()
at System.Web.UI.WebControls.HierarchicalDataBoundControl.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Troubleshoot issues with Windows SharePoint Services.
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: This page has encountered a critical error. Contact your system administrator if this problem persists.
Source Error:
Line 1: <%@ Page Inherits="Microsoft.SharePoint.Publishing.TemplateRedirectionPage,Microsoft.SharePoint.Publishing,
Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>
<%@ Reference VirtualPath="~TemplatePageUrl" %>
<%@ Reference VirtualPath="~masterurl/custom.master" %> Line 2: <html xmlns:mso="urn:schemas-microsoft-com:office:office"
xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"><head> Line 3: <!--[if gte mso 9]><xml>
Source File: /Pages/Default.aspx Line: 1
Safe mode did not start successfully. Could not load file or assembly ‘MyCompany, Version=1.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXX’ or one of its dependencies. The system cannot find the file specified.
In my case the error message from the event log was spot on. I had accidentally removed a MyCompany assembly from the GAC.
Other errors can also cause the same problem, whilst debugging this issue I came across another blog post that might be of interest: http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2008/09/24/safe-mode-did-not-start-successfully-request-failed.aspx
Posted in sharepoint | Tagged debugging, sharepoint | Leave a Comment »
Okay so ever needed to see if a particular web or site feature is activated? Well if it’s activated it will be in the SPWeb.Features SPFeatureCollection or SPSite.Features. If it’s not activated it won’t be. Simple.
To check if a feature is installed examine the feature definitions collection on the SPFarm object, below are a couple of little extension methods that demonstrate this concept.
/// <summary>
/// Defines extensions made to the <see cref="SPWeb"/> class
/// </summary>
[CLSCompliant(false)]
public static class SPWebExtensions
{
public static bool IsFeatureActivated(this SPWeb web, Guid featureId)
{
return web.Features[featureId] != null;
}
public static bool IsFeatureInstalled(this SPWeb web, Guid featureId)
{
SPFeatureDefinition featureDefinition = SPFarm.Local.FeatureDefinitions[featureId];
if (featureDefinition == null)
{
return false;
}
if (featureDefinition.Scope != SPFeatureScope.Web)
{
throw new GeneralApplicationException(
string.Format("Feature with the ID {0} was installed but is not scoped at the web level.", featureId));
}
return true;
}
}
Posted in .net, sharepoint | Tagged sharepoint, SPFeature, SPFeatureCollection, SPFeatureDefinition | Leave a Comment »
If you get this error message, which I did this morning opening up someone else’s SharePoint solution, make sure you have InfoPath installed.
Once I installed the InfoPath client application with .Net Programmability Support, see below, the targets file was installed to the MSBuild directory.
Posted in development, sharepoint | Tagged infopath, msbuild, sharepoint | Leave a Comment »
Okay simple solution here: Make sure that if you are not the root SPWeb and you want to add custom role definitions i.e. SPRoleDefinitions call SPRoleDefinitionCollection.BreakInheritance(bool,bool)
if (!web.IsRootWeb && !web.HasUniqueRoleDefinitions)
{
web.RoleDefinitions.BreakInheritance(true, false);
}
Posted in sharepoint | Tagged sharepoint, SPRoleDefinition | 1 Comment »
There are lots of reasons this error message can occur, see: http://www.google.com/search?q=sharepoint+Server+Out+Of+Memory. In my case it happened when a new site was being provisioned using a custom site definition during the ApplyWebTemplate call.
Turned out the there were subtle errors in my onet.xml. In particular I was referencing some document templates using an incorrect path:
<Project Title="$Resources:onet_TeamWebSite;" xmlns="http://schemas.microsoft.com/sharepoint/" Revision="2" ListDir="$Resources:core,lists_Folder;" xmlns:ows="Microsoft SharePoint">
...
<DocumentTemplates>
<DocumentTemplate Path="INCORRECTPATH" Name=""
Posted in bugs, sharepoint | Tagged bug, onet.xml, sharepoint | Leave a Comment »
Okay so its pretty easy to get the fully qualified domain name (FQDN).
using System.DirectoryServices; using System.DirectoryServices.ActiveDirectory; Console.WriteLine(Domain.GetCurrentDomain().Name)
But what happens if you want to get the old-skool netbios name. The quickest way is to use System.Environment:
using System Console.WriteLine(System.Environment.UserDomainName)
This gets the network domain name associated with the current user. So not much good if your code is running as a service that could well be configured to run at Network Account. Surely you can do this using DirectoryServices? Bit of Googling and coding and we have a nice little extension method which does just that
/// <summary>
/// Defines extentions made to the <see cref="Domain"/> class.
/// </summary>
public static class DomainExtensions
{
public static string GetNetbiosName(this Domain domain)
{
// Bind to RootDSE and grab the configuration naming context
DirectoryEntry rootDSE = new DirectoryEntry(@"LDAP://RootDSE");
DirectoryEntry partitions = new DirectoryEntry(@"LDAP://cn=Partitions," + rootDSE.Properties["configurationNamingContext"].Value);
DirectoryEntry domainEntry = domain.GetDirectoryEntry();
//Iterate through the cross references collection in the Partitions container
DirectorySearcher directorySearcher = new DirectorySearcher(partitions)
{
Filter = "(&(objectCategory=crossRef)(ncName=" +
domainEntry.Path
.Replace("LDAP://", string.Empty)
.Replace(domain.Name + "/", string.Empty) + "))",
SearchScope = SearchScope.Subtree
};
directorySearcher.PropertiesToLoad.Add("nETBIOSName");
//Display result (should only be one)
SearchResultCollection results = directorySearcher.FindAll();
if (results.Count == 0)
{
return null;
}
return results[0].Properties["nETBIOSName"][0].ToString();
}
}
Usage:
Domain.GetCurrentDomain().GetNetbiosName()
Note You can also retrieve the netbios entry using netapi32.dll http://blog.dotsmart.net/2009/03/11/getting-a-machine%E2%80%99s-netbios-domain-name-in-csharp
Posted in .net | Tagged .net, ActiveDirectory, DirectoryServices, Domain | 1 Comment »
I always forget the name of the class that stores a great big list of field ID constants. So as a reminder to myself it’s SPBuildInFieldId
For example:
SPFieldUserValue user = item[SPBuiltInFieldId.Author]
Whilst looking this up again I stumbled across another similar class SPBuiltInContentTypeId that holds content type id’s for the common OOTB content types, neat!
if (this.ContentTypeId.IsChildOf(SPBuiltInContentTypeId.Message))
{
......
}
Posted in sharepoint | Tagged field, fieldconstant, fieldid, sharepoint, SPBuiltInContentTypeId, SPBuiltInFieldId | Leave a Comment »