CHUVASH.eu

CHunky Universe of Vigourous Astonishing SHarepoint :)

Tag Archives: GAC

Struggling with Taxonomy in CSOM

The parts of the CSOM for updating Taxonomy fields are really cumbersome. I mean, look at this code, nicely provided by Vadim Gremyshev (@vgrem). To set a value in a taxonomy field we have to assemble a text representation, and adding a “fake” lookup id.

What is needed is a wrapper for handling Taxonomy fields. SPMeta2 and PnP don’t seem to have it yet.

Another issue that I have struggled with today was the missing Microsoft.SharePoint.Client.Taxonomy.dll. If you see this error (set customErrors=”Off” in the Web.config), then you have update the reference in the Visual Studio project:

missingtaxonomy-002

Open Properties for the reference called: Microsoft.SharePoint.Client.Taxonomy and ensure that Copy To Local is set to True:

missingtaxonomy-003

For some reason, this reference added through “App for SharePoint Web Toolkit” nuget package adds a reference to an assembly from your computers GAC.

Install a custom timer job in Powershell

First we have to create a class for our timer job which inherits SPTimerJobDefinition, build it and deploy it.

public class TakanaTimer : SPJobDefinition
{
	public TakanaTimer(){}
	public TakanaTimer(string jobName, SPService service,
		SPServer server, SPJobLockType targetType)
		: base(jobName, service, server, targetType) { }

	public TakanaTimer(string jobName, SPWebApplication webapp)
		: base(jobName, webapp, null, SPJobLockType.ContentDatabase)
	{
		Title = jobName;
	}
	public override void Execute(Guid contentDbId)
	{
		Log.Info("Running Takana Timer");
	}
}

There is a powershell example for this, but it has not been updated since MOSS.

In Powershell we need to load our custom assembly into powershell session:

[Reflection.Assembly]::LoadWithPartialName("Takana.Sharepoint.Timer")
$app = get-spwebapplication http://takana
$name = "takana-timer"
$job = new-object Takana.Sharepoint.Timer.TakanaTimer($name, $app)
$job.Schedule = [Microsoft.SharePoint.SPSchedule]::FromString("Every 15 minutes between 0 and 59")
$job.update()
#must restart timer service
restart-service sptimerv4

The cool thing here is also that we can create schedule from a text. The code is partially inspired by maraboustork

To remove a Timer Job, get the id of your timer job and run stsadm:

#Get the GUID of the timer job definition with the following cmdlet:
get-sptimerjob | sort-object -property Name | ft Name, Id
stsadm.exe -o deleteconfigurationobject -id

Or even better:

Get-SPTimerJob | where { $_.name -like “**” } |ft id,name
#Set job to a variable
$job = Get-SPTimerJob -id
#And delete it.
$job.Delete()

By the way, the whole list of ootb timers.

Вула Чăвашла

VulaCV - Чăвашла вулаттаракан сайт

Discovering SharePoint

And going crazy doing it

Bram de Jager - Coder, Speaker, Author

Office 365, SharePoint and Azure

SharePoint Dragons

Nikander & Margriet on SharePoint

Paul J. Swider - RealActivity

RealActivity is a specialized Microsoft healthcare services and solution advisory firm.

Cameron Dwyer

Office 365, SharePoint, Azure, OnePlace Solutions & Life's Other Little Wonders

paul.tavares

Me and My doings!

Share SharePoint Points !

By Mohit Vashishtha

Jimmy Janlén "Den Scrummande Konsulten"

Erfarenheter, synpunkter och raljerande om Scrum från Jimmy Janlén

Aryan Nava

DevOps, Cloud and Blockchain Consultant

SPJoel

SharePoint for everyone

SharePointRyan

Ryan Dennis is a SharePoint Solution Architect with a passion for SharePoint and PowerShell

SharePoint 2020

The Vision for a Future of Clarity

Aharoni in Unicode

Treacle tarts for great justice

... And All That JS

JavaScript, Web Apps and SharePoint

blksthl

Mostly what I know about SharePoint - CommunicoCuspis