#SharePoint site collection is in Read Only mode!

Every day, the Administrator do his normal stuff as usual, but sometimes when he tries to take a backup for a site collection, the progress of backing up data is too slow, then he canceled the process and tried another one, while he received a call from end user that his site is turned into Read Only!

The normal diagnostic is checking “Configure quotas and locks” from Central Administration, but after a quick look you will find it disabling all its options like below:

So what’s the solution?!

Fortunately, Microsoft provides us with a very easy solution by a few lines of PowerShell commands:

  • Open SharePoint Management Shell using Administrator account
  • In the PS prompt type accurately the following lines:
PS C:\Users\Admin> $SiteUrl = new-object Microsoft.SharePoint.Administration.SPSiteAdministration(‘http:// sitecollectionurl’)
PS C:\Users\Admin> $SiteUrl.ClearMaintenanceMode()

 

After that the Read Only message and state will be ended, and you can take backup or do regular work.

Posted in SharePoint General | Leave a comment

Download all Microsoft #Build2016 conference videos and slides

For whom missed the great conference of Microsoft Build 2016, here you are the chance to download all the conference without following each link or running out of time!

I have re-developed a PowerShell script to do so, thanks to Vlad Catrinescu whom first made a script for downloading SharePoint conference videos (https://absolute-sharepoint.com/2014/03/ultimate-script-download-sharepoint-conference-2014-videos-slides.html)

You can save the following code as (Build2016.PS1) file and then execute it with PS normally, if PowerShell refused to execute it You just need to change theExecution policy on your computer using a simple Powershell command.

Set-ExecutionPolicy RemoteSigned

This will allow you to run scripts that have been written by “a trusted publisher” (Microsoft determines who is trusted and who isn’t).

Here you are the code:

# Script: DownloadMSBuild2016.ps1
# Version: 1.0 - 2016-04-02
# Author:Hossam kamal (Sr. SharePoint Developer, blog: https://sharepointhero.wordpress.com/)
# Originally published as a SharePoint Conf script by: Vlad Catrinescu (http://absolute-sharepoint.com/2014/03/ultimate-script-download-sharepoint-conference-2014-videos-slides.html)
# I Customized it for Microsoft Build 2016 Conference



Write-Host "###############################################################################################"  -ForegroundColor Yellow
Write-Host "                                                                                               "  -ForegroundColor Yellow
Write-Host "                     Download Microsoft Build 2016 Videos and PPTX                            "  -ForegroundColor Green
Write-Host "                by Hossam kamal (Sr. SharePoint Developer, blog: https://sharepointhero.wordpress.com/)                    "  
Write-Host "                                                                                               "  -ForegroundColor Yellow
Write-Host "         Based on the SharePoint Conference download script by Vlad Catrinescu                 "
Write-Host "                                                                                               "  -ForegroundColor Yellow
Write-Host "###############################################################################################"  -ForegroundColor Yellow

[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath 
$rss = (new-object net.webclient)

# Grab the RSS feed for the MP4 Mobile quality downloads
# Microsoft Build  Conference 2016 Videos and Slides
$a = ([xml]$rss.downloadstring("https://s.ch9.ms/Events/Build/2016/RSS/mp4")) 
$b = ([xml]$rss.downloadstring("https://s.ch9.ms/Events/Build/2016/RSS/slides")) 

#High quality for the videos or if you want mp3 replace the bellow links with the upper
# $a = ([xml]$rss.downloadstring("https://s.ch9.ms/Events/Build/2016/RSS/mp4high")) 
#$a = ([xml]$rss.downloadstring("https://s.ch9.ms/Events/Build/2016/RSS/mp3")) 


$downloadlocation = "C:\Build2016"

	if (-not (Test-Path $downloadlocation)) { 
		Write-Host "Folder $fpath dosen't exist. Creating it..."  
		New-Item $downloadlocation -type directory 
	}
set-location $downloadlocation

#Download all the slides	
$b.rss.channel.item | foreach{   
	$code = $_.comments.split("/") | select -last 1	   
	
	# Grab the URL for the PPTX file
	$urlpptx = New-Object System.Uri($_.enclosure.url)  
    $filepptx = $code + "-" + $_.creator + " - " + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "").Replace("|", "").Replace('"',"").Replace("*","")
	$filepptx = $filepptx.substring(0, [System.Math]::Min(120, $filepptx.Length))
	$filepptx = $filepptx.trim()
	$filepptx = $filepptx + ".pptx" 
	if ($code -ne "")
	{
		 $folder = $code + " - " + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "").Replace("|", "").Replace('"',"").Replace("*","")
		 $folder = $folder.substring(0, [System.Math]::Min(100, $folder.Length))
		 $folder = $folder.trim()
	}
    if ($folder.EndsWith("."))
         {
            $folder = $folder.substring(0, ($folder.Length) - 1).trim()
         }

	else
	{
		$folder = "NoCodeSessions"
	}
	
	if (-not (Test-Path $folder)) { 
		Write-Host "Folder $folder dosen't exist. Creating it..."  
		New-Item $folder -type directory 
	}
	
	#text description from session 
	$OutFile = New-Item -type file "$($downloadlocation)\$($Folder)\$($Code.trim()).txt" -Force  
    $Category = "" ; $Content = ""
    $_.category | foreach {$Category += $_ + ","}
    $Content = $_.title.trim() + "`r`n" + $_.creator + "`r`n" + $_.summary.trim() + "`r`n" + "`r`n" + $Category.Substring(0,$Category.Length -1)
   add-content $OutFile $Content

	# Make sure the PowerPoint file doesn't already exist
	if (!(test-path "$downloadlocation\$folder\$filepptx"))     
	{ 	
		# Echo out the  file that's being downloaded
		$filepptx
		$wc = (New-Object System.Net.WebClient)  

		# Download the MP4 file
		$wc.DownloadFile($urlpptx, "$downloadlocation\$filepptx")
		mv $filepptx $folder 

	}
	}

#download all mp4 mobile quality only
# Walk through each item in the feed 
$a.rss.channel.item | foreach{   
	$code = $_.comments.split("/") | select -last 1	   
	
	# Grab the URL for the MP4 file
	$url = New-Object System.Uri($_.enclosure.url)  
	
	# Create the local file name for the MP4 download
	$file = $code + "-" + $_.creator + "-" + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "").Replace("|", "").Replace('"',"").Replace("*","")
	$file = $file.substring(0, [System.Math]::Min(120, $file.Length))
	$file = $file.trim()
	$file = $file + ".mp4"  
	
	if ($code -ne "")
	{
		 $folder = $code + " - " + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "").Replace("|", "").Replace('"',"").Replace("*","")
		 $folder = $folder.substring(0, [System.Math]::Min(100, $folder.Length))
		 $folder = $folder.trim()
	}
    if ($folder.EndsWith("."))
         {
            $folder = $folder.substring(0, ($folder.Length) - 1).trim()
         }
	else
	{
		$folder = "NoCodeSessions"
	}
	
	# Make sure the MP4 file doesn't already exist

	if (!(test-path "$folder\$file"))     
	{ 	
		# Echo out the  file that's being downloaded
		$file
		$wc = (New-Object System.Net.WebClient)  

		# Download the MP4 file
		$wc.DownloadFile($url, "$downloadlocation\$file")
		mv $file $folder
	}
	
		
	}

If you want a downloaded copy of .PS1 file you can download it from here:

https://www.dropbox.com/s/whazl6x0nncr8yw/MSBuild2016VideoAndSlides.ps1?dl=0

Enjoy J.

Posted in SharePoint General | Leave a comment

The tool was unable to install application server role, web server (IIS) role error in #SharePoint 2013

When installing SharePoint 2013, if the server is online, then we regualarly use the (prerequisiteinstaller) to download and configure the prerequisites, but sometimes it will not work for you, due to many reasons, may be the Windows Server version or any other.

One of the common problems is the error of (The tool was unable to install application server role, web server (IIS) role),


After trying many solutions I have found a funny one J

When tracing the log file of the error I found the prerequisiteinstaller.exe is trying to access an exe file within C:\windows\system32, the file name was ( ServerManagerCMD.exe), while the actual name within the same folder was (ServerManager.exe), the solution is very simple, copy that file (ServerManager.exe), and paste it to desktop or wherever, then rename it to be (ServerManagerCMD.exe), yet you can copy it and paste it to the path referred in the log file (C:\windows\system32), don’t worry the old one still function, then go to your prerequisiteinstaller.exe file and you will notice it will work like magic with you :


Don’t worry if the ServerManager console open with you, you can close it and continue working no problem.

And finally:

Posted in SharePoint General | 2 Comments

#SharePoint 2013 Installation Problem, Error when installing AppFabric 1.1 on Server 2012 64bit

One of the Common errors that someone may face while installing SharePoint 2013 prerequisites of AppFabric application, is the error of:

“AppFabric installation failed because installer MSI returned with error code : 1603 ”

(Step 1)

This error may occurs due to many reasons, one of them is PSModulePath corruption, you may try to check the ” EnvironmentVariables“, and check the value of PSModulePath; find it here:

System Properties -> Environment Variables -> System Variables.

And check its value to be exactly like that: ( %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\) without braces, if it was written correctly if not, just correct it, and then try your setup gain, if it not working for you, then you should do the following:

(Step 2)

Open you Server Manager and from Tools menu open Computer Management:

 

Or just type in Run command: Compmgmt.msc , and it will open Computer Management for you.

Then check groups and find if these two groups are existed : AS_Administrators and AS_Observers Security Groups , if so,  just delete them, as it was added by AppFabric setup program and recheck your installation again, it should now work for you:

And the result after doing the above steps should be like that:

Posted in SharePoint General | Leave a comment

Adding World Clock, and Exchange Rates Web Parts to #SharePoint

One of the most required accessories web parts to SharePoint portals is “World Clock web part” and ” Exchange Rates web part”, today I’m going to show you how to implement both with your SharePoint environment.

  • Adding World Clock:

First, you should know that there are dozens of free or purchased versions of this web part, but why to purchase when you can make one J

SharePoint Object Model provide us with a class library for Regional Settings which include local and global time zones, you can find it within ” Microsoft.SharePoint.dll under the class property  ” SPRegionalSettings.GlobalTimeZones “:

  • Create a new Visual Web part
  • Add a Grid View control to the web part, and name it: grdWorldClock
  • In the .CS file for the visual web part add the “Microsoft.SharePoint” name space
  • In the page load section add the following code:

    protected
    void Page_Load(object sender, EventArgs e)

    {

    SPTimeZoneCollection timeZoneColl = SPRegionalSettings.GlobalTimeZones;

    // Creating table 

    DataTable dt = new
    DataTable();

    // Adding Columns

    dt.Columns.Add(“Description”);

    dt.Columns.Add(“Time Zone”);

    foreach (SPTimeZone tz in timeZoneColl)

    {

    DateTime currentLocalDateTime = DateTime.Now;

    DateTime currentDestDateTime = tz.UTCToLocalTime(currentLocalDateTime.ToUniversalTime());

    // Adding Rows

    DataRow dr;

    dr = dt.NewRow();

    dr[“Description”] = tz.Description.ToString();

    dr[“Time Zone”] = currentDestDateTime.ToString();

    dt.Rows.Add(dr);

    }

    // Connecting Data Source to our GridView

    grdWorldClock.DataSource = dt;

    grdWorldClock.DataBind();

    dt.Dispose();

    }

  • Just deploy your solution to your farm and you will see the results like below:

With some UI tweaks you can enhance the interface and make it better view, also you can make it as a dropdown list and the results changes upon click.

Also there is a fast solution using a ready made code from the well know site “Clock Link”, and here you are the link to code:

http://www.clocklink.com/gallery/view/world001

You can add it within your Embedded Code area:

Then insert the following code:

Then the result will be like that:

Enjoy J.

 

  • Now how to add an Exchange Rates web part.

It’s very simple, just go to The Money Converter web site http://themoneyconverter.com and from the upper side select Exchange Rates, then from the table there select your currency preference, I have picked up SAR, http://themoneyconverter.com/SAR/Exchange_Rates_For_Saudi_Riyal.aspx

Then from the left side select RSS feeds which is automatically generated for SAR, http://themoneyconverter.com/rss-feed/SAR/rss.xml.

Now add an RSS Viewer web part to your desired page:

Then in the property menu add the RSS link like below:

Then after adding it the web part will load the exchange rate data for your selected currency like below:

 

You can also enhance the preview by tweaking UI.

Posted in SharePoint General | Leave a comment

Reporting with Visual Studio and Crystal Reports

Well, today I have a good chance for review a book of a friend of mine Engineer: Mahmoud ElKoush, the book about Reporting with Visual Studio and Crystal Reports, really the book is very useful though it’s simple but it’s powerful, I totally recommend this book for whom have no time for reading and needs a quick reference for reporting, as today projects’ full of BI and Reporting Services, which is very important for decision making, and data representing.

As a Sr. SharePoint Developer I found my needs on this, and I’m sure you will too.

You can find this book here:

http://bit.ly/1hWaKer

Enjoy J

 

Posted in SharePoint General | Leave a comment

#SharePoint, Solving Open this task problem in Outlook

When you make an Approval Workflow for any document library, the regular scenario is sending the approval details via an email, SharePoint compatible with Outlook adds a button which know as Open this task button, the below image is exactly what you receive when a task assigned to you from the approval workflow:

But unfortunately when clicking this button for completing the task, we have like the below error:

After few searching for this error I have to know the suggested reasons for it:

  1. The form template is not available.
  2. The form template cannot be downloaded from the site.
  3. The form template was not sent in the e-mail message.
  4. The form template was not published to a shared location.

And the suggested resolution is to add the URL for the form template to your trusted sites or local zone and ensure that the person has ‘Contribute’, the minimum permissions required to update InfoPath forms.

But no way L, I have tried all the known solutions without good results, my suggestion to the error is due to cross domain, and LB failures, but the hope is that we have a workaround solution, which also gives more power to the workflow mail actions, as the OWA don’t give you the option of (Open this task) button through web, you must have Outlook.

The Solution is easy, when you make your approval workflow, click on Approval Action to edit it like below:

You will have four options to edit the Action, click change the behavior of a single task like below:

It will give you the detailed steps for the approval process, search for any email sending actions like below:

Then click each one to edit its content, we are going to add the Open task as a link inside the email body, type any text you want for example (Open this task), then click on the Hyper link button in the right corner of the email defining screen like below:

It will open a screen for editing the link, in the Address section click on the String Builder button like below in step (1), then click the Add or Change Lookup button like below in step (2), then in the Data Source section dropdown the list and choose Workflow Context, then in the Field from source section Choose Current Site URL like below in step (3), then O.K to save changes in all windows:

 

Then the String Builder will be like below, add the following URL snippet behind the added Context (/WorkflowTasks/DispForm.aspx?ID=):
Where (WorkflowTasks) is the name of the current workflow Task list, and (DispForm.aspx) is the display page for the workflow task, and the (ID) is current task ID, which we add this ID , like below steps (2) and (3):

Then O.K to save all changes like before, you will notice like below, that your added text converted to URL, press O.K to finish editing the sending mail action body

 

Now, repeat the above steps for the remaining email sending actions, and after finishing all, just publish your workflow:

Now test your document workflow, and notice the incoming email to you like below, the link can now open your task form to edit it, approve, reject, cancel, or reassign the task, and also from OWA too, notice that the Open this task button still appear, no way till Microsoft found a solution we can use it later J :

Posted in SharePoint General | 23 Comments