Skip to content

Posts from the ‘Sharepoint’ Category

23
Dec

Backup Sharepoint Sites with Powershell

This will backup your sharepoint sites to a given path and delete any backups older than 3 days old.

param(
    $backupPath = $("You must enter a location to place the backup files")
)

$ver = $host | select version
if ($ver.Version.Major -gt 1)  {$Host.Runspace.ThreadOptions = "ReuseThread"}
Add-PsSnapin Microsoft.SharePoint.PowerShell

$fileDate = get-date -f yyyyMMdd
get-spwebapplication | get-spsite | %{$filePath = $backupPath + $_.URL.Replace("http://", "").Replace("/", "-") + "_" + $fileDate + ".bak" ; backup-spsite -identity $_.URL -path $filePath}

$files = get-childitem -path $backupPath | where{$_.Extension -eq ".bak"}
foreach($file in $files)
{
    if($file.CreationTime -lt (get-date).addDays(-3))
    {
        remove-item $file.FullName -force
    }
}
2
Dec

Presence Indicator not showing in Sharepoint 2010

If your presence indicator in sharepoint 2010 isn’t showing, you have to add your sharepoint site to your trusted sites:

image

Hit the Sites button, add your root sharepoint site and the presence indicator should now show up.

image

30
Oct

Access is Denied error when Crawling Sharepoint 2010

When trying to get search working correctly, the full crawl on our sharepoint2010 server kept coming back with “Access is denied. Check that the Default Content Access Account has access to this content, or add a crawl rule to crawl this content”.  This error is due to MS implementing a loopback check to prevent reflection attacks.  To disable the loopback check, do the following:

  1. Open Regedit
  2. Navigate to HKLM\CurrentControlSet\Control\Lsa
  3. Create a new DWord (32-bit) value called DisableLoopbackCheck and set its value to 1
  4. Kick off a crawl
  5. Profit $$$
12
May

Get items from sharepoint list

private ArrayList GetServerList()
{
ArrayList sNames = new ArrayList();
Guid id = new Guid(“46089E30-FCD1-45C9-9437-454754C5058D”);
SPSite SiteCol = new SPSite(id);
SPList splist = SiteCol.AllWebs[“”].Lists[“Servers”];

SPQuery oQuery = new SPQuery();
oQuery.Query = “” +
“True”;
SPListItemCollection listItems = splist.GetItems(oQuery);

foreach (SPListItem listitem in listItems)
{
sNames.Add(listitem[“ServerName”].ToString());
//string test = listitem[“ServerName”].ToString();
}
return sNames;
}

29
Apr

Sharepoint 2010 Edit Page Button Missing

I just fought with this for two days.  Apparently, the “edit page” button on Sharepoint 2010 only shows on regular pages, not web part pages.  Who knew.  This was a migrated Sharepoint application from 2007 to 2010, so I had no idea that the page was a web part page and not a regular page.