Archive for the ‘SharePoint 2010 Foundation’ Category

If you ever forget to run the product and technology wizard ( disconnect) then uninstall SharePoint, you will run into issues when you attempt to create a new farm or join a different farm.

Open Regedit then navigate to this registry section, then delete the “ dsn” string.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\Secure\ConfigDB

p.s. I highly recommend you attempt this step only in a last resort. You should always follow this uninstallation guidance from MS. http://technet.microsoft.com/en-us/library/cc262874.aspx

Create a new document library.

clip_image002

Create a new content type.

clip_image004

Add your newly created content type to the newly created list.

clip_image006

clip_image008

clip_image010

Create a new document.

clip_image012

Create your footer, or any other document template modifications. Then save document back to the SharePoint document library. Then close MS word.

7

clip_image016

Re-edit the MS word Document.

clip_image018

Add the Document ID Value to the footer. Then save the document as a word document template(.dotx) to the desktop or similar location.

clip_image020

clip_image022

Site Content Types > Content type >Advanced Settings.

clip_image024

Upload the document template just created.

clip_image026

Create new document to confirm your changes have been completed.

clip_image028

Make some changes to the document. Then save this document to SharePoint. Close MS word. Re-open the document, notice the Document ID value is now changed.

P.s. If you would like to use the Document ID as a label. The reference is {Document ID Value}

Run these PowerShell Commands:

 

1
2
$StartUsageHealthDataCollectionProxy  = Get-SPServiceApplicationProxy | ? {$_.TypeName -like "*Usage and Health*"}
$StartUsageHealthDataCollectionProxy.Provision()

Error encountered in background cache check Microsoft.SharePoint.SPEndpointAddressNotFoundException: There are no addresses available for this application.

Make sure you have the corresponding service running for each Service Application that you have created.

ex: Check that you started the “Managed Metadata Web Service”. This can be found here:  Central Admin > System Settings > Manage Services On Server

A client needed a way to remove old domain users from their SharePoint 2010 farm. There was a company merger and they did not want the old domain users showing in the sites.

Enter the root site collection and the search parameter ex: domain and done.

** you might notice a table being created… I left this in here, but its not really used. The client had some additional requirements, that I have not included in this script.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
## Reference to SharePoint DLL
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
 
##Ask for WebApp Root url to enumerate or scope scan
Write-Host "Please enter root url of WebApplication, ex: http://contoso"
$siteurl = Read-Host "Value "
Write-Host "Please enter the search parameter, ex: contoso "
$searchP = Read-Host "Value "
 
##Create Table - ScanTable
$ScanTable = New-Object system.Data.DataTable "ScanTable"
$col1 = New-Object system.Data.DataColumn ("LoginName", [string])
$col2 = New-Object system.Data.DataColumn ("URL", [string])
$ScanTable.columns.add($col1)
$ScanTable.columns.add($col2)
 
##Returning info for use in remainder of script
$webapp = [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup($siteurl)
##Start looping through the sites collections
foreach ($site in $webapp.Sites)
{
    $spSite = new-object Microsoft.SharePoint.SPSite($site.url)
	$spWeb = $spSite.OpenWeb()
 
	##Save file path, guid, and title of each closed webpart
	foreach ($_.LoginName in $spSite.RootWeb.SiteUsers | select LoginName)
	{
	if ($_.LoginName -like "*$searchP*")
	{
	$output = $ScanTable.Rows.Add($_.LoginName, $site.url)
	$spWeb.SiteUsers.Remove($_.LoginName)
	}
	}
 
	##Clean Up
    $spSite.Dispose()
    $spWeb.Dispose()
}
 
##Write txt file
Write-Output $ScanTable | select URL | Sort-Object URL -Unique | Out-File C:users.txt -Append

By default the SharePoint Trace service runs as local system.This script will fix that. 

1. Create a SharePoint 2010 Trace Account. Ex: SPTrace

2. Edit lines 2 and 3 of the PowerShell script.

3. Run script on each server in farm. (not FAST or SQL servers) a. PS C:UsersspinstallDesktop> .TraceAccountFix.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Trace Account Details
$TraceAccount = "DomainSPTrace"
$TraceAcctPWD = "Enter The password here"
$SecTraceAcctPWD = (ConvertTo-SecureString $TraceAcctPWD -AsPlainText -force)
 
# Formatting
$TraceAccountDomain,$TraceAccountUser = $TraceAccount -Split "\"
 
# Get the tracing service.
$farm = Get-SPFarm
$tracingService = $farm.Services | where {$_.Name -eq "SPTraceV4"}
 
$Cred_TraceAcct = New-Object System.Management.Automation.PsCredential $TraceAccount,$SecTraceAcctPWD
 
## Add Managed Account for Trace Account
$ManagedAccountTrace = Get-SPManagedAccount | Where-Object {$_.UserName -eq $TraceAccount}
If ($ManagedAccountTrace -eq $NULL) 
{ 
	Write-Host -ForegroundColor White "- Registering managed account" $TraceAccount
	New-SPManagedAccount -Credential $Cred_TraceAcct | Out-Null 
}
Else {Write-Host -ForegroundColor White "- Managed account $TraceAccount already exists, continuing."}
 
 
# Get the managed account.
$managedAccount = Get-SPManagedAccount "$TraceAccount"
If ($tracingService.ProcessIdentity.ManagedAccount -notlike "*$managedAccount*"){
 
# Set the tracing service to run under the managed account.
$tracingService.ProcessIdentity.CurrentIdentityType = "SpecificUser"
$tracingService.ProcessIdentity.ManagedAccount = $managedAccount
$tracingService.ProcessIdentity.Update()
 
# This actually changes the "Run As" account of the Windows service.
$tracingService.ProcessIdentity.Deploy()
}
 
Try{
([ADSI]"WinNT://$env:COMPUTERNAME/Performance Log Users,group").Add("WinNT://$TraceAccountDomain/$TraceAccountUser")
}
catch {Write-Host -ForegroundColor White " - $TraceAccount is already an in the Performance Log Users group, continuing."}
 
Write-Host "All Done"

Error:

The list cannot be displayed in datasheet view for one or more of the following reasons:

-          A datasheet component compatible with Microsoft SharePoint foundation is not installed.

-          Your web browser does not support ActiveX controls.

-          A component is not properly configured for 32-bit or 64-bit support.

If your running office 2010 x64, as of now the only work around to this is to install office 2010 x86. This may change in the future..

This PowerShell Script will flush the cache for all web applications.
1
2
3
4
5
6
7
8
9
10
11
12
13
Write-Host -ForegroundColor White " - Enabling SP PowerShell cmdlets..."
If ((Get-PsSnapin |?{$_.Name -eq "Microsoft.SharePoint.PowerShell"})-eq $null)
{
$PSSnapin = Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | Out-Null
}
$webAppall = Get-SPWebApplication
foreach ($_.URL in $webAppall) {
$webApp = Get-SPWebApplication $_.URL
[Microsoft.SharePoint.Publishing.PublishingCache]::FlushBlobCache($webApp)
Write-Host "Flushed the BLOB cache for:" $webApp
}
Write-Host -ForegroundColor White " - Enabling SP PowerShell cmdlets..."If ((Get-PsSnapin |?{$_.Name -eq "Microsoft.SharePoint.PowerShell"})-eq $null){   $PSSnapin = Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | Out-Null}
$webAppall = Get-SPWebApplicationforeach ($_.URL in $webAppall) {$webApp = Get-SPWebApplication $_.URL[Microsoft.SharePoint.Publishing.PublishingCache]::FlushBlobCache($webApp)Write-Host "Flushed the BLOB cache for:" $webApp}

The other day, I was asked to debug the “Tagged Items” web part within SharePoint 2010. You can see this web part in action when clicking on a tag, in someones profile page. The link then takes you to tagprofile.aspx page, and shows you(by default) 60 days worth of tagging of the specfied tag / keyword.

The problem was PDF icons didn’t didn’t seem to work correctly. The first thing that came to mind was the DocIcon.xml, which I knew by default doesn’t have any entry’s for PDF Documents. So I went ahead and added this line to the DocIcon.xml :  <Mapping Key=”pdf” Value=”pdficon.gif”/>

Then I reset IIS and as expected in document library’s, I now showed a PDF Icon instead of the blank / default icon. However when I clicked the tag it still showed the red x next to the document title. I thought for a second, and then remembered that when SharePoint needs the larger icon, for a specified extension, it will append ”lg_” to whatever is listed in the DocIcon.xml. In my example this file name would be “lg_pdficon.gif”. Since I did not place the larger size icon file in the /images folder, this icon would not render. One I did, it rendered correctly.

The moral of the story is make sure you name your PDF file with a standard name ex: “pdficon.gif” this way SharePoint will be easily be able to reference the large icon by “lg_pdficon.gif” . The main reason for calling out the standized naming convention is because many of the PDF document walk thoughs on the internet use pdficon_small.gif as the name. Which when you add “lg_pdficon_small.gif ” seems a bit weird to me…

Notes**

The small icon should be 16×16 and the large should be 32×32.

Adobe Linking site. ( all the PDF icons you will every need… ) : http://www.adobe.com/misc/linking.html

More information about DocIcon.xml : http://msdn.microsoft.com/en-us/library/ms463701.aspx

Let me know if you have any troubles. Thanks!!

  • Archives

  • Tags

  • Subscribe
  • Pages

  • More

  • Disclaimer…

    This is my personal weblog. The opinions expressed herein are my own and are not representative of any 3rd party influence. The owner of this blog reserves the right to edit or delete any comments submitted to this blog without notice if they are deemed to be spam, offensive or otherwise inappropriate. The owner of this blog makes no representations as to the accuracy or completeness of any information on this site or found by following any link on this site. The owner will not be liable for any errors or omissions in this information nor for the availability of this information. The owner will not be liable for any losses, injuries, or damages from the display or use of this information.


    Lastly, I do my best to document my sources if the article is not of my own creation. If I have missed or forgotten to source your work. I would love feedback via the comments section. Thank you.

DreamHost promos
SiteLock