Showing posts with label Tony Di Leonardo. Show all posts
Showing posts with label Tony Di Leonardo. Show all posts

Saturday, April 30, 2016

Maintenance Plan for SharePoint 2010 Best Practices documentented incorrectly..

While working with a large client we ran into issue with the documentation for SharePoint Maintenance Plans in this SharePoint 2010 Best Practices Document.  Andy Lin, a colleague and expert SQL DBA found the problem.  It appears when you set the fill factor to from inside the GUI in SQL 2012  to rebuild the index and change per page percentage settings in the maintenance plan to 80 percent it does the opposite and sets it to 20.

Microsoft provided a wrong setting in the SharePoint best practice document. 

Yes the Fill Factor changed to 80 percent in the  2010 documentFree Space Per Page means opposite to Fill, should be 20 percent if you want Fill Factor to be 80 percent. See View T-SQL for the plan shows FILLFACTOR=80.

  It will be worse if we set a reverse value to 20 percent as shown below.


by Tony Di Leonardo via Everyone's Blog Posts - SharePoint Community

Tuesday, February 23, 2016

Download your template file (*.stp) and expand it.

First, download the site template from the solutions gallery to a file, I usually create a directory called solutions for this procedure:

  1. Navigate to the top-level site of your site collection.
  2. Click Settings, and then click Site Settings.

  3. In the Web Designer Galleries section, click Solutions.

  4. To download the solution, click its name in the solutions gallery, and click Save. Then, in the Save As dialog box, browse to the location where you want to save the solution, click Save, and then click Close.

Now, you will rename the file from the command prompt to cabinet file or *.cab file.

Extract the files

I am using 7zip to extract the files from the cabinet file.  I will then place the files in the solutions directory in a directory with the name of the file (in this case it was TemplateX2). 

Note:

All files that are actually just cabinet files (*.cab)

  • .dwp = SharePoint dashboard or web part file
  • .stp =  Sharepoint list or library template
  • .wsp = Windows SharePoint solution file

 


by Tony Di Leonardo via Everyone's Blog Posts - SharePoint Community

Saturday, May 16, 2015

Disclaimer Popup in SharePoint 2010 or 2013

Having a disclaimer popup in SharePoint is something that is necessary for many businesses and their internal external web sites.  This is usually a mandate for legal requirements for tracking legal agreements.  Recently we had to add a disclaimer that upon agreement granted you access to the existing extranet site.  After reading the disclaimer users would either press ok or cancel.   

  • [Ok] allows you in the site, drops a cookie on your machine and grants you access to the entire site and sub-sites until the next year when the cookie expires.
  • [Cancel] will take you out of the site and request your login again.
  • The cookie will be active on all sites and sub-sites in SharePoint, any URL from the root.

In order to perform this you need to have the disclaimer JavaScript in every site and sub-site in the root zone.  This is accomplished by the path=/.  All you have to do is place this code in the default masterpage at the bottom in between the </body> and the </html> tags.  Change the disclaimer under the decision variable.  The popup will only occur once.  Special thanks to my friend Ed Goad and his book he wrote, Windows Server 2012 Automation with PowerShell Cookbook this inspired me to right this JAVA script.  Here is the code that I wrote that performs this activity.  Be sure to save check in and publish the masterpage if you are editing in SharePoint designer.

<script type="text/javascript" language="javascript">

var agreement = GetCookie();

// checks for cookie and displays disclaimer alert if new user

if (agreement == "") {

//Author: Tony Di Leonardo

var decision = confirm("DISCLAIMER: GOES HERE \n\nClick Ok if you agree to the disclaimer or click Cancel to close this window. \n");

if (decision == true) {

// writes a cookie

var oneMinute = 60 * 1000

var oneHour = oneMinute * 60

var oneDay = oneHour * 24

var today = new Date()

var nextXmas = new Date()

nextXmas.setMonth(11)

nextXmas.setDate(31)

if (today.getMonth() == 11 && today.getDate() > 31) {

nextXmas.setFullYear(nextXmas.getFullYear() + 1)

}

var expiredays = nextXmas.getTime() - today.getTime()

expiredays = Math.floor(expiredays/oneDay)

var exdate = new Date()

exdate.setDate(exdate.getDate() + expiredays)

document.cookie = "PartnerAgreement" + "=" + escape("Agree To Disclaimer") +

((expiredays == null) ? "" : ";path=/; expires=" + exdate.toGMTString())

}

else {

// redirect

window.location = "/_layouts/signout.aspx";

// or close the browser window

//window.opener='x';

//window.close();

}

}

// gets the Cookie if it exists

function GetCookie() {

if (document.cookie.length > 0) {

c_name = "PartnerAgreement";

c_start = document.cookie.indexOf(c_name + "=")

if (c_start != -1) {

c_start = c_start + c_name.length + 1

c_end = document.cookie.indexOf(";", c_start)

if (c_end == -1) c_end = document.cookie.length

return agreement = unescape(document.cookie.substring(c_start, c_end))

}

}

return "";

}

</script>


by Tony Di Leonardo via Everyone's Blog Posts - SharePoint Community