Posts

Copy List Item Programmatically

public void CopyItem(SPListItem srcItem, SPListItem destItem) { foreach (SPField field in srcItem.Fields) { if (!field.ReadOnlyField && field.InternalName != "Attachments") { destItem[field.InternalName] = srcItem[field.InternalName]; } } foreach (string attachmentName in srcItem.Attachments) { SPFile file = srcItem.ParentList.ParentWeb.GetFile(srcItem.Attachments.UrlPrefix + attachmentName); byte[] data = file.OpenBinary(); destItem.Attachments.Add(attachmentName, data); } destItem.Update(); }

December 2014 Cumulative Updates For SharePoint 2010

The Cumulative Update (December 2014) for SharePoint 2010 has been released : SharePoint Foundation: http://support2.microsoft.com/kb/2899585 SharePoint Server 2010: http://support2.microsoft.com/kb/2899583 Project Server 2010: http://support2.microsoft.com/kb/2899587 Office 2010 : http://support2.microsoft.com/kb/3020815

Export ContentDataBase Name in csv file

<# Created by : Gaurav Goyal    Purpose : To Export Content Database Name in csv file.    Comments : Run With Admin Privileges \ Read operation. #> $csv="./CSV.csv" $i=1; SC $csv "ID,DBName,WebApplicationName,CurrentSiteCount" write-host "`nGetting WebApplication Names`n"; $WebApps = Get-SPWebApplication  foreach($WebAppUrl in $WebApps) { write-host "$i) Getting ContentDataBase name of WebApp" $WebAppUrl.Url "`n" ;$i++; $toCSV=Get-SPContentDatabase -site $WebAppUrl.Url; AC $csv "$($toCSV.Id),$($toCSV.Name),$($toCSV.WebApplication),$($toCSV.CurrentSiteCount)" } write-host "Exporting List of All DB.....`n" Get-SPDatabase | epcsv ".\AllDataBaseList.csv"

Configure ADFS, Claim-Based Authentication and IFD for MS CRM 2013

Limitation of Active Directory Federation Services (ADFS) 1.         ADFS requires default website & default port like port 80 & 443. On the server where you are going to install & configure ADFS, port no 80 & 443 should be available. 2.         When Claim is enabled HTTPS must be used both for internal & external. You need wild card certificate for Claim-Based Authentication & IFD DNS Configuration You need to create at least 5 host name in DC: Forward Lookup Zone (For DNS Resolution) 1.         ADFS 2.0 URL (External Domain :  adfs2. mydomain.com  : https://adfs2.contoso.com/FederationMetadata/2007-06/FederationMetadata.xml) 2.         CRM Server IFD URL (CRM IFD Federation endpoint, e.g.  crmauth.mydomain.com ) 3.         CRM Discovery Service endpoint ( crmdiscovery.mydomain.com ) 4.         CRM Org URL ( myOrg1.mydomain.com ) 5.         Internal URL to access the CRM (CRM Claims Federation endpoint,  internalCRM.mydomain.com ) Install ADFS on CRM server or

New Site Collection Through PowerShell

#Creates a SPSite in a new content database Add-PSSnapin Microsoft.SharePoint.Powershell - ErrorAction SilentlyContinue; $siteName = "IT"; $webAppUrl = "http://intranet2013.mydomain.com"; $template = "STS#0"; $ownerAlias = "mydomain\ggoyal"; $secondaryOwnerAlias = "mydomain\ggoyal"; $siteUrl = "$webAppUrl/sites/$siteName"; $databaseName = "SharePoint_Intranet_$siteName"; $databaseServer = "Test-Server"; New-SPContentDatabase -Name $databaseName -DatabaseServer $databaseServer -WebApplication $webAppUrl; New-SPSite -Url $siteUrl -OwnerAlias $ownerAlias -SecondaryOwnerAlias $secondaryOwnerAlias -ContentDatabase $databaseName -Template $template -Name $siteName; # New SPSite does not create the default groups $web = Get-SPWeb $siteUrl; $web.CreateDefaultAssociatedGroups("i:0#.w|$ownerAlias", "i:0#.w|$secondaryOwnerAlias", $siteName); $web.update();

September 9, 2014 Cumulative Updates for SharePoint 2013

Cumulative Update for SharePoint 2013 has been released for September 9, 2014 SharePoint Foundation 2013 : http://support.microsoft.com/kb/2883087 SharePoint Server 2013 : http://support.microsoft.com/kb/2883068 Project Server 2013 : http://support.microsoft.com/kb/2883072 Office 2013 : http://support.microsoft.com/kb/2995905

Find Missing Web Part

Image
Whenever a SharePoint Developer or Administrator opens Central Administration site, they usually see a notification on top of CA site which shows all the warnings & issues with the SharePoint Farm & Servers. When you hit “View these issues”, You will get list of issues and warnings. In this list you will find a common error “Missing server site dependencies”. When you click on the “Missing server site dependencies”, you will get list of errors with like these kinds of messages: [MissingWebPart] WebPart class [8d6034c4-a416-e535-281a-6b714894e1aa] is referenced [2] times in the database [WSS_Content], but is not installed on the current farm. Please install any feature/solution which contains this web part. One or more web parts are referenced in the database [WSS_Content], but are not installed on the current farm. Please install any feature or solution which contains these web parts. I was wondering to find our missing web pars f