Tag Info

Hot answers tagged

7

If fetching of item["ID"] instead of 'Title' works AND If you are using the SPQuery object. Then, include the columns that you want to fetch in the ViewFields property of SPQuery. This will resolve your issue. Reference: ...


5

Here are few more differences between Timer Job and Windows Task schedulers: Timer Jobs Timer jobs require downtime to deploy. Control via Central Admin. Schedule of Timer Job will be backed up and restore in your normal process of SharePoint backup and restore. Can be deployed using standard WSP solution. Custom Timer Jobs provides the power to specify ...


4

For a client solution I would use the Search REST API. The grouping has to be done on the client, it depends on how you configure your Managed Properties. The trick with People is to pass the correct Result Source ID in the query: For example: ...


4

The chosen language cannot be the reason why your job doesn't work. Regardless of language it compiles in the same MSIL. Did you check ULS for any errors related to your job? Did you check ULS settings - maybe it configured not to log some messages? Did you check job status in Central Administration?


3

There are two key points to the Timer Job. The class which represents the timer job, and then the code that actually registers the job. This is typically done within a feature receiver on the feature that contains the timer job. Here is some code on MSDN: http://msdn.microsoft.com/en-us/library/cc406686.aspx#WSSCustomTimerJobs_DeployingCustomTimerJobs ...


3

I think you have only deployed the solution (wsp) file of the timer job. You will also need to activate the feature for your timer job. Go to the Site collection features of your Web-application and Activate your timer job feature from there. This should start showing your timer job in the list of Job Definitions in the Central Administration. I hope this ...


3

Our operations team says when you have a task that is really related to SharePoint, maybe list items iteration, logging etc etc. you should use Timer Job.. But if you have tasks not related to SharePoint at all or directly.. Than use Task Scheduler.. Example, we had an External Content Type made from SQL Server Database and the user wanted to iterate ...


3

I like Arsalan's answer, however MS is pushing people to avoid server side development, which includes Timer Jobs. As timer jobs run on the SharePoint server, a poorly written timer job can have a negative impact on the farm. Also, if a customer ever moves to Office 365, any custom timer jobs will have to be re-written. An app run by the windows task ...


3

For every web application you can do the following: Get your timer job definition (SPJobDefinition) from SPWebApplication.JobDefinitions Get the guid: string jobDefID = SPJobDefinition.Id.ToString(); Add the guid in the query string http://srvr/_admin/JobEdit.aspx?JobId=jobDefID


2

When a timer job instance is created, it is persisted to the farm configuration database. Accessing this database for write purposes is a privileged operation; as a rule of thumb, only the farm service account (that is, the account under which OWSTIMER.EXE executes) or accounts that explicitly have the rights. So application pool account wouldn't work, as ...


2

You should get site url as below. string siteUrl = this.Properties["SiteURL"].ToString(); and use below code to get current web in timerjob. using (SPSite site = new SPSite(siteUrl)) { using (SPWeb CurrentWeb = site.OpenWeb()) { // Write code here } }


2

You could try stroring the site url in timerjob properties collection and retrieve it in the Execute method of timerjob In the feature activated event store the siteUrl string key = "mySiteUrl"; string value = web.Url; TimerJob tmrJob = new TimerJob(webApp); //remove the key if already exists bool isKeyExists = tmrJob.Properties.ContainsKey(key); if ...


2

The OWSTIMER doesn't run in a web context and does not have immediate access to your web application web.config files. You can use something like this tutorial to read web.config values from your web apps: http://praveenbattula.blogspot.com/2009/12/access-webconfig-in-sharepoint-timer.html You can also create an app.config file right next to the ...


2

I have been developing timer job for quiet a while now and always created myself a Event log specially for timer job to log when it started or stopped and also if there is any error came up while execution. I use this code to write messages to event log you can also add code to send an email to a specific user in case of error if you would like to, private ...


2

I vaguely remember encountering something like this in the past, and whilst the details escape me, I think that adding the -Force parameter to Install-SPSolution resolved the issue. I think this was in relation to features rather than timer jobs, but it might be a starting point.


2

Benefits of Sharepoint Timer jobs over Windows Task Scheduler are : Single point of failure : Windows Task Scheduler need to be configured on all the web servers. If you configure to run the job on 1 server only, and this server crashes, job will not work at all. Status Reporting : Windows Task Scheduler doesn't have any reporting on when was the last time ...


1

Schedule a PowerShell script task schedule which goes through all the user profiles and writes to SharePoint List. You can also use PowerShell to perform ordering and sorting on the objects returned. Note: the script below loops through all the user profiles, you can complete it by writing it your SharePoint List + Scheduling it as a Task. #Add ...


1

This post have details. The info extract from the Post Notice how the schedule is set for the timer job. The SPMinuteSchedule.BeginSecond property and the SPMinuteSchedule.EndSecond property specify a start window of execution. The SharePoint Timer service starts the timer job at a random time between the BeginSecond property and the EndSecond ...


1

You could have the timer job create an item with a column holding the user name (ideally in a hidden list or maybe add a column to the users list ?) Then you can create a delegate control or a small javascript wich checks if the current user is on that list and if the is has been created less than 5 days ago, if yes then show popup.


1

One thing I've found with CAML (and this may or may not actually help you here) is that true != TRUE and false != FALSE. I've been burned by that before. Use all caps there. Also, fieldRef should be FieldRef. So the CAML to try would be: "<Where>" + "<Gt>" + "<FieldRef Name='myDate'/>" + "<Value Type='DateTime' ...


1

Could you debug the timer job locally in your dev enviornment. Remember to restart the timer service in your dev enviornment before you attach to the owstimer service from Visual Studio. If you can successfully attach and debug locally ensure the url to the site and list are the same in your UAT/PROD enviornment. Hope this helps


1

Here is how you get SPServiceContext: public void UserProfileSample() { //get current service context string websiteUrl = "http://SampleName"; SPSite site = new SPSite(strUrl); SPServiceContext serviceContext = SPServiceContext.GetContext(site); //initialize user profile config manager object UserProfileManager upm = new ...


1

One thing to remember when you are using site-scoped or site collection–scoped Features to install the timer jobs: The account that does the scheduling must have write permissions to the configuration database of the server farm. Usually, the identity of the application pool that is hosting the SharePoint site does not have permissions on the configuration ...


1

From msdn about SPSecurity.RunWithElevatedPrivileges Executes the specified method with Full Control rights even if the user does not otherwise have Full Control Jobs are executed under SharePoint timer service account. This account could have not full control permissions. It's permissions could be restricted.


1

In order to execute RunNow method Farm Administrator rights are required. When you use RunWithElevatedPrivileges method, the code runs in the context of application pool account, which usually does not have farm admin rights (and it should not have it according to best practices) So the solution is to run the code in context of some user that does have farm ...


1

When the instance of job definition is created it ID property is initialized via base SPPersistedObject constructor to Guid.NewGuid() : protected SPPersistedObject(string name, SPPersistedObject parent) : this(name, parent, Guid.NewGuid()) { }


1

Since all SharePoint timer jobs are inheriting Microsoft.SharePoint.Administration.SPJobDefinition which inherits SPPersistedObject, these timer jobs are written in the Hierarchical Object Store which is directly in the SPFarm database. Here is some more information about the previous sentence. Anyway, the point is that your context is important when ...


1

If you look through the job definitions and schedule you will see that the server is busy managing 100s of jobs an hour. These are meant to run pretty quick. When doing large sets of workloads, its typically a better idea to use the timer job for the scheduling and management of the work, but move the work somewhere else. It might be better to perhaps ...


1

A timer job that runs in the context of a web app (which is one of the two options (and the simplest)) has full access to the entire web app. You you have to do to access a sub-site's list is refer to the site it is in, then find the subsite and finally the list. Getting a site from a web app: SPSite site = webApp.Sites[SiteName] Setting a sub site ...


1

Make sure you delete the job in your feature activation in addition to stopping and starting the timer job. According to Microsoft documentation you must delete the job in your feature deactivation before it is re-added. http://msdn.microsoft.com/en-us/library/hh528519(v=office.14).aspx C# public override void FeatureActivated( ...



Only top voted, non community-wiki answers of a minimum length are eligible