Search This Blog

Showing posts with label SharePoint. Show all posts
Showing posts with label SharePoint. Show all posts

Saturday, May 14, 2016

SharePoint Solution stuck on deploying, retracting and many other related issues

I recently came across very strange and frustrating issue related to timer job. The timer job is responsible for majority of scheduled task within SharePoint. Any solution which is deployed also get scheduled to be deployed across farm with the help of timer job.

The issue started after updating the SharePoint 2010 farm with Service Pack 1. Any deployment or retraction action cannot complete thereafter. If you are deploying a solution the status will forever remain as deploying. Same is the case with retracting and any other timer dependent activity.

I did all troubleshooting as suggested in various forums:
  1. Cleared SharePoint cache
  2.  Performed all suggestion on these blog posts:
    1. SharePoint 2010 Troubleshooting: Solution deployment stuck on deploying
    2. SharePoint 2010: Solution Package Deployment stuck in Deploying status
    3. http://blog.degree.no/2012/08/sharepoint-2010-solution-stuck-retracting-deploying/
However; the problem still persisted. 

Later, I got a solution from MSDN blog by Tehnoon Raza - SharePoint Server 2010: Timer Jobs not Functioning After Applying Updates. I ran the powershell script and all problems were fixed. I have mentioned the powershell script for easy reference:

$farm  = Get-SPFarm 
$disabledTimers = $farm.TimerService.Instances | where {$_.Status -ne "Online"} 
if ($disabledTimers -ne $null) 
{ 
    foreach ($timer in $disabledTimers) 
    { 
        Write-Host "Timer service instance on server " $timer.Server.Name " is not Online. Current status:" $timer.Status 
        Write-Host "Attempting to set the status of the service instance to online" 
        $timer.Status = [Microsoft.SharePoint.Administration.SPObjectStatus]::Online 
        $timer.Update() 
    } 
} 
else 
{ 
    Write-Host "All Timer Service Instances in the farm are online! No problems found" 
}

Monday, August 10, 2015

Search Crawl Error - Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository.....

Problem
After Windows updates were applied to the SharePoint Server, the search service failed to crawl the content. 

Error
"Access is denied.  Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository being crawled is a SharePoint repository, verify that the account you are using has “Full Read” permissions on the SharePoint Web Application being crawled."

Cause
The windows update actually enabled the Loopbackcheck leading to crawl failure. The other related problem you will often observe is that you cannot login as another user if you have opened Central Admin on the server itself.


Resolution

There are two possible solutions listed at the Microsoft KB article.

Solution 1: Specify host names (Preferred method if NTLM authentication is desired)
Method 2: Disable the loopback check (less-recommended method)

For detail steps follow this link  to the KB article. 

Sunday, April 3, 2011

Click event stopped firing after ajax postback

I had a user control on a SharePoint master page for one our client portal which was taking longer to load than other modules on the pages. 

Deciding to load this control asynchronously to speed up the page load I achieved this by adding button control inside the Ajax update panel. This button remains hidden from users view. I made the button click event to fire using JavaScript function by pushing it to body onload event using SharePoint's _spBodyOnLoadFunctionNames function.

The control worked as expected, causing the button click event to fire and processing the server side logic. However, the other buttons, link buttons and other server on other modules lost their events. Now nothing happens whenever I click on any server side button controls.

We tried various different options like calling the JavaScript function right into the script tag, mentioning it on the master page’s body onload event etc,. The final one which worked was ScriptManager's registerstartupscript function i.e. ScriptManager.RegisterStartupScript on the server side page load event. I registered the JavaScript function call using the RegisterStartupScript function provided by ScriptManager object. Now the page worked perfectly without any issue. Buttons, hyperlink buttons all worked smoothly.

I am still not sure what caused events to break by calling the function right into the page load. Your suggestions and advice are welcome.

Saturday, March 19, 2011

Updating List Item from Workflow and avoid repeated firing of workflow

I have a list having a custom workflow attached to it. Workflow is executed whenever any updates are done to the item. Apart from performing various other task, the workflow also need to update a field of that item.

So what is the problem?

There is no issue updating any item from the workflow. You can use workflowProperties.Item["FieldName"] = "Value" to update any field. The side effect is updating the item triggers the workflow again as it is configured to execute when item is modified. This causes the workflow to run in indefinite loop.
So what is the solution?

Create a new class within the workflow and inherit it with SPItemEventReceiver. Create two new functions called DisableWorkflow() and EnableWorkflow().

Inside DisableWorkflow() add a line –
this.DisableEventFiring

Inside EnableWorkflow() add a line –
this.EnableEventFiring

That’s it, just create a object of this class, call DisableWorkflow() just before workflowProperties.Item.Update() .Then call EnableWorkflow() after updating the item.

Thursday, August 19, 2010

Deleting Individual events from a recurring series

In order to delete an individual event from a recurring series, you actually need to create a new event and set a few properties on it to link it up to a specific instance from the 'owning' series. You will need to set the following properties (You need all of them!):
  • MasterSeriesItemID
    • Set this to the ID of the owning calendar list item
  • UID
    • Set this to the UID of the ownding calendar list item. If you haven't populated this column in your owning list item, you'll be having all sorts of problems already...
  • EventType
    • Set this to 3 to mark it as a deleted record
  • fRecurrence
    • Set this to 1
  • fAllDayEvent
    • Set this to the fAllDayEvent property of the owner calendar list item
  • EventDate
    • Set this to the date of the event instance you want to delete
  • EndDate
    • Set this to the date of the event instance you want to delete
  • RecurrenceID
    • Set this to the date of the event instance you want to delete. (Yep, this is the one that caught me out...has to be set to a datetime and NOT an ID)
  • Title
    • Set this to the title of the owner calendar event, but prefixed with Deleted:
When you have done this, you should now see an additional event in the All Events view of the calendar with a title of "Deleted: Name of your event" and the date of the specific instance. In the Calendar view, the specific instance should be invisible. This means that if you want to undo your deleted instance, you simply delete the extra list item that you have created and it will reappear!

The above extract is taken from Justin French's Blog. Justin's post talks more about working with SharePoint's Recurring Events. Do check it out.