Archive for March, 2011

A glossary for SharePoint 2010 –

Wednesday, March 16th, 2011

I’m not copying the table on this one, here’s the link: http://msdn.microsoft.com/en-us/library/ee556558.aspx

List of tokens in SharePoint 2010

Monday, March 14th, 2011

Here is a handy table I found here http://msdn.microsoft.com/en-us/library/ee231545.aspx¬†explaining what tokens are and which ones there are. I know I can just post hte link but including the table makes it more handy ūüôā

Name Description
$SharePoint.Project.FileName$ The name of the containing project file, such as, “NewProj.csproj”.
$SharePoint.Project.FileNameWithoutExtension$ The name of the containing project file without the file name extension. For example, “NewProj”.
$SharePoint.Project.AssemblyFullName$ The display name (strong name) of the containing project’s output assembly.
$SharePoint.Project.AssemblyFileName$ The name of the containing project’s output assembly.
$SharePoint.Project.AssemblyFileNameWithoutExtension$ The name of the containing project’s output assembly, without the file name extension.
$SharePoint.Project.AssemblyPublicKeyToken$ The public key token of the containing project‚Äôs output assembly, converted to a string. (16-characters in “x2” hexadecimal format.)
$SharePoint.Package.Name$ The name of the containing package.
$SharePoint.Package.FileName$ The name of the containing package’s definition file.
$SharePoint.Package.FileNameWithoutExtension$ The name (without extension) of the containing package’s definition file.
$SharePoint.Package.Id$ The SharePoint ID for the containing package. If a feature is used in more than one package, then this value will change.
$SharePoint.Feature.FileName$ The name of the definition file of the containing feature, such as Feature1.feature.
$SharePoint.Feature.FileNameWithoutExtension$ The name of the feature definition file, without the file name extension.
$SharePoint.Feature.DeploymentPath$ The name of the folder that contains the feature in the package. This token equates to the “Deployment Path” property in the Feature Designer. An example value is, “Project1_Feature1”.
$SharePoint.Feature.Id$ The SharePoint ID of the containing feature. This token, as with all feature-level tokens, can be used only by files included in a package via a feature, not added directly to a package outside of a feature.
$SharePoint.ProjectItem.Name$ The name of the project item (not its file name), as obtained from ISharePointProjectItem.Name.
$SharePoint.Type.<GUID>.AssemblyQualifiedName$ The assembly qualified name of the type matching the GUID of the token. The format of the GUID is lowercase and corresponds to the Guid.ToString(“D”) format (that is, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
$SharePoint.Type.<GUID>.FullName$ The full name of the type matching the GUID in the token. The format of the GUID is lowercase and corresponds to the Guid.ToString(“D”) format (that is, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

InfoPath 2010 – SPContexts, code behind and sandboxed solutions

Monday, March 14th, 2011

I was recently tasked with adding some code behind to an InfoPath 2010 form and having it submit to multiple SharePoint lists. The issue I ran into was trying to get spcontext to work in a sandboxed solution. I couldn’t. Try as hard as I could, the spcontext was not being passed. I was getting the error that the object was not set to the instance of the object. Bottom line, when using Infopath 2010 in sandboxed mode, with security level of domain, you do not have access to the SPCONTEXT object. So everytime I tried to call it, it wouldn’t be called and the value was being set to Null.

The first solution is to set your InfoPath form to full trust and have an administrator approve it. But, I didn’t want to do that. All I wanted was to get the URL of the site. SO I did something neat. I found the SaveLocation that InfoPath stores and pulled out the URL from that.

¬†string strPath = e.InputParameters[“SaveLocation”].ToString();
¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬† string strLoc = strPath.Substring(0, strPath.LastIndexOf(“/”));

            XPathNavigator mainNav = this.CreateNavigator();
            //this line will set a value for the field

¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬† mainNav.SelectSingleNode(“//my:SiteUrl”, NamespaceManager).SetValue(strLoc.Substring(0, strLoc.LastIndexOf(“/”)).ToString());
            
¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†Then I just use my form variable in my SPSite declaration and i’m good to go.

using (SPSite site = new SPSite(MainDataSource.CreateNavigator().SelectSingleNode(“//my:SiteUrl”, NamespaceManager).Value))

If anyone can tell me why SPcontext isn’t available in the security level of Domain Trust in an InfoPath form, i would love to hear it.