Monday, April 20, 2015

Sharepoint Task List - hiding the timeline from a view in c#

Ever wonder how to remove the timeline from a task list view using c#?  Me too.  Here is the answer...


var list = web.Lists[Constants.Lists.TaskList];
var view = list.Views["All Tasks"];
view.ViewData = "";
view.Update();  

That's hours and hours of my life I'll never get back.

Wednesday, March 4, 2015

SharePoint 2013 - edit navigation term with powershell

I had a requirement to edit a term for a site with powershell to set the "Change target page for this term" property for a term-driven page.

The powershell I used is:

$site = Get-SPSite $portalUrl
$taxSession = Get-SPTaxonomySession -Site $site
$termStore = $taxSession.TermStores[$managedMetadataService]
$termStoreGroup = $termStore.Groups[$termStoreGroup]
$termSet = $termStoreGroup.TermSets[$termSet]
$term = $termSet.Terms.Item($term)
$term.SetLocalCustomProperty("_Sys_Nav_TargetUrl", $newUrl)
$termStore.CommitAll()

Sunday, February 22, 2015

Sharepoint 2013 - showing Task Due Date in Content Query Web Part (CQWP)

To get the Due Date of a task to appear in a content query web part you need to configure the web part to use 'TaskDueDate', not 'DueDate'.  This then resolves in the web part to Due Date [Core Task and Issue Columns].

Visual Studio stuck on "Waiting for parse to complete..."

Today when I opened my sharepoint 2013 solution in Visual Studio 2013 it got stuck loading a project with the message in the status bar of "Waiting for parse to complete...".  Yesterday before I closed visual studio I was looking at a large xsl file which I had left open before closing visual studio.  I think this may have been the file it was stuck on?

The way I fixed it was to remove the mapping in Visual Studio to the solution and re-add it in Source Control Explorer.  To remove mapping:
  1. Backup your source code to another folder
  2. go to Source Control Explorer
  3. right click on the folder that contains the solution
  4. Go to Advanced > Remove Mapping...

Monday, February 16, 2015

Visual Studio - display selected file in solution explorer

Everytime I need to set this up I can't remember how. 

It is very handy when you have a Visual Studio project with a large number of files to have the file you are working on highlighted in the solution explorer.  This doesn't happen automatically but is super easy to set up.

Tools > Options > Projects and Solutions > General > Track Active item in Solution Explorer

Done!

Monday, February 9, 2015

User Profile Synchronization Service

That old gem of getting the user profile synchronization service running bit me today.  Thanks so much to SharePointBjorn for supplying the powershell script to fix it.

Sunday, February 8, 2015

SharePoint 2013 - Creating a view to show tasks assigned to me and groups that I am a member of

I have a requirement to create a view to show tasks that are:
  • assigned to me, and
  • assigned to groups that I am a member of
Thanks to this blog for the answer:  Filter Sharepoint Task Llist View To Show Tasks Assigned To Groups I am in.

The Where clause for the view needs to be:

 
<Or>
  <Membership Type="CurrentUserGroups">
    <FieldRef Name="AssignedTo"/>
  </Membership>
  <Eq>
    <FieldRef Name="AssignedTo"/>
    <Value Type="Integer">
      <UserID/>
    </Value>
  </Eq>
</Or>


And that is all.