Tuesday, October 6, 2009

digitally signing an Infopath Form Template so that it can run as Full Trust

Richard has been working on an InfoPath/SharePoint project recently, and his tip relates to digitally signing an Infopath Form Template so that it can run as Full Trust.

An Infopath Form needs to run at Full Trust when Managed Code is added to the form. http://msdn.microsoft.com/en-us/library/bb251020.aspx.

To avoid purchasing a code-signing certificate you can issue a self-signed certificate. You need to make sure that the certificate that you request is a code-signing certificate. And to do this you need to enable code-signing in the certificate authority. http://www.thorprojects.com/blog/archive/2007/06/30/domain-certificate-authority-signing-infopath-2007-forms.aspx.

So far so good. The problem that I have experienced is that the certificate that is received is not trusted. And so additional steps are required to make the certificate trusted. If you do not do this then the certificate will not be available to sign the Infopath form.

Export the self-signed certificate from the Personal\Certificates node. Select both the Cryptographic Message Syntax Standard – PKCS #7 Certificates (.P7B) and Include all certificates in the certification path if possible options on the Export File Format page.

Import the exported self-signed certificate into Trusted Root Certification Authorities\Certificates node.

At this point you can sign the Infopath form. http://office.microsoft.com/en-us/infopath/HP101636661033.aspx

Monday, April 13, 2009

"Checked out to me" report across SharePoint Site Collections and WebApps

Ever wondered how to view all documents checked out to you across your SharePoint farm (so across multiple Site Collections)? The following will without any custom coding provide you with a way to search for documents that have been checked out to a specific user using standard SharePoint search indexing and features.

Below you will add a new Managed Property which maps to the list meta data field holding the name of the user the item has been checked out to. You will then do a full crawl, and finally modify your Advanced Search to allow a user to search for documents checked out to the user, or to any other user for that matter.

  • Create a new Managed Property
    - Go into Shared Services
    - Go to Search Administration, Metadata Properties
    - Click to create “New Managed Property”
Use the following details:

Property name: CheckedOutTo
Type: Text
Mappings: add mapping to "ows_CheckoutUser(Text)"



  • After adding the new managed property, start a full crawl of the relevant content source

At thsi point you could go back in and verify if any items have been indexed (click on the managed search property and check the status of number of indexed items containing a value for this property). If zero, then there are no checked-out documents.

You are now ready to prepare the SharePoint Advanced Search to include an option to search for documents that have been checked out to a user:

  • Go to a Site Collection with Advanced Search, and edit your Advanced Search page
  • Modify the Advanced Search web part to include the new property as a selectable search property by adding two new entries in the properties XML for the Advanced Search Box webpart:



    The properties XML should now include the following new entries:

    In the PropertyDefs section add:
    PropertyDef Name="CheckedOutTo" DataType="text" DisplayName="Checked out to"

    And in the section ResultType DisplayName="All Results" Name="default", add
    PropertyRef Name="CheckedOutTo"
After saving these changes to the properties, your Advanced Search page should now include a new selectable property displayed as “Checked out to”:


Select the new property, enter the full name of the user (e.g. "Joe B. Loggs") and hit "Search". If the user has any documents checked out, then you should see them coming up in the results.
This is a method that is useful when not wanting to utilise any custom code or third party components.
Let me know what you think or if you find this useful. Comments always welcome.

Gabriel




Standard "Checked out to me" report

This report for some reason escaped my attention until recently when a client prompted me to look for it.

So...
1) Go to the root site of a Site Collection (not all site collection templates will include this)

2) From “Site Actions”, choose “View Reports” and “Checked out to me”.

Very useful!

Only problem is that it only shows the report for one single Site Collection.

Another blog is being posted in a bit showing you how you can create a search across all Site Collections (and Web Apps) for document that have been checked out to you, or anyone else for that matter. (click here read the next post here)

Enjoy this tip... I know I did ;-)

Gabriel

Monday, March 30, 2009

VSeWSS 1.3 - all DLLs have to be accessible

This tool or extension has some unexpected behaviour :


When you create a deploy package all the DLLs that your project references have to be accessible .... this is normal so far.

But, the problem is that all the DLLs referenced by your directly referenced DLLs also have to be accessible.

The immediate (and obvious) way to solve this problem is to copy these DLLs to the GAC (not so great in large scale production deployment scenarios). However we have found that you can also fix the problem by copying the DLLs to the server side VSeWSS "bin" folder (i.e. the VSeWSS extension has a small web application that generates the wsp for you) which typically resides in “C:\Program Files (x86)\Microsoft SharePoint Developer Tools 9.0\svc\bin”.

Hopefully the tricks above will work for you, but let us know if you have any better work-around or better practice for solving this particular problem ;-)

CAML query - getting more than 10 results

Another thing you should keep in mind when you use CAML QUERING is the fact that by default the query is going to return just the first 10 result so you should specify the maximum number of row that you want the query return to you, you achieve this with the tag : <Range><StartAt>1</StartAt><Count>10000</Count></Range>

 

Using the example above to get 10,000 results your query could look like this:

 

<Query>

   <Where>

      [.....]

   </Where>

  <Range>

    <StartAt>1</StartAt>

    <Count>10000</Count>

  </Range>

</Query>

 

Useful to use this parameters to page results.

 

Another CAML (tip) from Miguel ;-)

 

CAML query with more than two conditions

CAML queries seem to have a weird restriction that prevents you from using more than 2 conditions in a row. For example, this query doesn’t work:

 

<Query>

   <Where>

      <And>

            <Eq>

               <FieldRef Name='Title' />

               <Value Type='Text'>A</Value>

            </Eq>

            <Eq>

               <FieldRef Name='_UIVersionString' />

               <Value Type='Text'>B</Value>

            </Eq>

           <Eq>

              <FieldRef Name='FirstName' />

              <Value Type='Text'>C</Value>

           </Eq>

      </And>

   </Where>

</Query>

 

In the above you will notice that there are three “AND” conditions (the <Eq>’s) in a row so we need to wrap the condition in groups of two and nest the conditions like this:

 

<Query>

   <Where>

      <And>

         <And>

            <Eq>

               <FieldRef Name='Title' />

               <Value Type='Text'>A</Value>

            </Eq>

            <Eq>

               <FieldRef Name='_UIVersionString' />

               <Value Type='Text'>B</Value>

            </Eq>

         </And>

         <Eq>

            <FieldRef Name='FirstName' />

            <Value Type='Text'>C</Value>

         </Eq>

      </And>

   </Where>

</Query>

 

Miguel figured this one out recently and kindly shared.....

Welcome to Tips for SharePoint

Traditionally (and now I am talking a few years), good SharePoint documentation was scarse and hard to come by. This has changed somewhat. Better books are available, there are better best-practices, and Microsoft's own documentation is even getting better.

So .... this blog site is really just our developers' way of logging some of those tips and tricks that we have come across, and some of those we have come up with ourselves.

Feel free to contribute with your comments, tips and tricks. Obviously if you find a trick to solve a particular problem that is better than any that we might provide - shout!!!

So.... Welcome to Tips for SharePoint, from The SharePoint People