Wednesday, February 22, 2012

CSS to change the Header of WebParts in SharePoint 2010

Describes how to customize a standard Web Part in SharePoint by using SharePoint Designer 2010. Depending of the look and feel such as accessibility, performance or cross browser stability it could be a challenge to bend the web part UI exactly in the way you want. The markup of the web parts in SharePoint contains quite a deep nested table structure and the elements do not always have an id or class. 

Download the images and put them into Images library or change the path in the CSS below if you want to put the images in some other folder.

/* WebPart headers */

02 /* All tdS in the row */

03 .ms-WPHeader > TD{ 

04 background-image: url('/Style Library/BlogBranding/Images/WP-MidGreen.png'); 

05 background-repeat:repeat-x;  

06 padding-left:1px; padding-right:1px; height:33px; 

07 border-bottom-style:none!important;border-bottom-color:inherit!important; border-bottom-width:0px!important; 

08 } 

09 /* Left cell */

10 .ms-WPHeader td:first-child { 

11 width:5px; 

12 background-image:url('/Style Library/BlogBranding/Images/WP-LeftGreen.png')!important; 

13 background-repeat:no-repeat; 

14 } 

15 /* Right cell */

16 .ms-wpTdSpace { 

17 width:7px; 

18 background-image:url('/Style Library/BlogBranding/Images/WP-RightGreen.png')!important; 

19 background-repeat:no-repeat; 

20 background-color:transparent; 

21 } 

22 /* Arrow */

23 .ms-WPHeaderTdMenu{ 

24 background-color:transparent; 

25 border:0px!important; 

26 } 

27 /* Web part title */

28 .ms-WPTitle { 

29 padding-left:10px; 

30 font-family:Arial, Helvetica, sans-serif; 

31 color:#fff; 

32 font-weight:bold; 

33 margin-bottom:1px; 

34 font-size:14px; 

35 } 

36 /* linked title and visited */

37 .ms-WPTitle a, .ms-WPTitle a:visited { 

38 color:#fff; 

39 text-decoration:none; 

40 } 

41 /* hover title */

42 .ms-WPTitle a:hover { 

43 color:#333; 

44 text-decoration:none; 

45 } 

46 /* hover web part menu */

47 .ms-WPHeaderTdMenu:hover{ 

48 border-left:1px solid transparent; 

49 background-image: url('/Style Library/BlogBranding/Images/WP-MidGreen.png'); 

50 }
 

Wednesday, February 15, 2012

Removing "Download a Copy" context menu from a Document Library in MOSS2007

 SharePoint 2007 (MOSS/WSS) - how to remove "Download a Copy" context menu from a Document Library

http://blogs.msdn.com/b/pranab/archive/2008/12/06/sharepoint-2007-moss-wss-how-to-remove-download-a-copy-context-menu-from-a-document-library.aspx



SharePoint 2010:

Here is what I did:
1. Added a Content Editor webpart to the AllItems.aspx page
2. Added following HTML into the HTML source of CEWP.

<style>
A[id$='Ribbon.Documents.Copies.Download-Large'] {
    DISPLAY: none
}</style>

Adding and Removing a Button from the Server Ribbon

Please follow the link to Add/Remove Buttons from the Server Ribbon.

http://msdn.microsoft.com/en-us/library/ff408060.aspx#2


Friday, February 3, 2012

HTTP 500 (Service Unavailable) Could not load all ISAPI filters for site/service. Therefore startup aborted

I have migrated MOSS 2007 Environment from 32bit to 64bit. After running the Sharepoint products and technologies configuration wizard successfully, the central administration site page opens up.
( We were installing MOSS 2007 on 64 bit machine)

But in my case it was giving the following error “Service Unavailable”
Checking into event log gave the following information
<!--[if gte mso 9]> Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 <![endif]--><!--[if gte mso 9]> <![endif]--> <!--[endif]-->Could not load all ISAPI filters for site/service. Therefore startup aborted.

and

<!--[if gte mso 9]> Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 <![endif]--><!--[if gte mso 9]> <![endif]--> <!--[endif]-->

ISAPI Filter ‘C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_filter.dll’ could not be loaded due to a configuration problem. The current configuration only supports loading images built for a AMD64 processor architecture. The data field contains the error number. To learn more about this issue, including how to troubleshooting this kind of processor architecture mismatch error, see http://go.microsoft.com/fwlink/?LinkId=29349.

Searching for it the solution that I found was the following

// Disabling the 32bit mode for your web site.

cscript C:\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 0
and then the following

// Registering ASP.NET 2.0 as the default framework for that web site

C:\Windows\Microsoft.NET\Framework64\v2.0.50727> 
aspnet_regiis.exe -i



Installation of SharePoint 2010 using local accounts


Something that was possible in SharePoint Server 2007 has become tricky in SharePoint Server 2010. The complete installation on a single server using non-domain accounts. Something most developers, demonstrators and testers do a lot of suddenly requires the use of domain accounts instead of local machine accounts. Or does it....

The recommendation for a single server build of SharePoint 2010 is to use the Stand Alone installation giving you SQL express and a default configuration. But what if you want to use SQL Server 2008 and to have more control over the build, and to use local service accounts. In this case you need to use complete install and either PowerShell alone or a combination of Windows PowerShell and PSCONFIG(UI).EXE

To begin with carry out your SharePoint 2010 installation using the advanced option and complete as the server type. This is recommended in a farm configuration.
Next you would think to use either PSCONFIG or PSCONFIGUI to create the farm. Well you would be wrong PSCONFIG.EXE -cmd configdb -create -server neilhw2k8r2 -database sharepoint_2010_config -user neilhw2k8r2\administrator -password ******** -passphrase ********
-admincontentdatabase sharepoint2010_admincontent

Results in SharePoint Products Configuration Wizard version 14.0.4514.1009. Copyright (C) Microsoft Corporation 2010. All rights reserved.The specified user neilhw2k8r2\administrator is a local account.Local accounts should only be used in stand alone mode.So how do we get around this limitation without using the corporate domain or else promoting the server to a domain controller.
Windows PowerShell is your friend, New-SPConfigurationDatabase allows you to specify none domain credentials for the farm.


To execute this command launch the SharePoint 2010 management shell (in the same location as the central admin link) and simply type the command at the cursor and press enter.


 The beauty of the Windows PowerShell approach is you get prompted for the missing command line attributes instead of the rather horrible error dialog that PSConfig throws at you. After this completes you will find in SQL a new configuration database and an admin content database (unfortunately the GUID is back but that can be fixed if necessary). Next the simplest way to complete the installation is Run the PSConfig wizard as you now are starting with the server already joined to the farm.
























Follow the wizard through the same options as you had with SharePoint 2007 and complete the installation/configuration with the following screen
Clicking Finish launches the central admin website and after agreeing to report back customer experiences to Microsoft (or not) you get your first look at SharePoint 2010 central admin and the configuration wizards.

Get Row Count for every table in database.

This script will gives row number for every table in database.

USE AdventureWorks
GO
SELECT OBJECT_NAME(OBJECT_ID) TableName, st.row_countFROM sys.dm_db_partition_stats stWHERE index_id < 2ORDER BY st.row_count DESCGO

Thursday, February 2, 2012

SSRS Scale Out Web Farm 401.1 - Unauthorized

Our topology:
Internal corporate network domain utilizing Integrated Windows Authentication between local workstations and the web and database servers. (domain similiar to: http://reports.ourdomain.com)

Machine #1: Windows 2003 Server w/SQL Server 2005 (SP2 and hotfixes applied) running SSRS.
Machine #2: Windows 2003 Server w/SSRS only. (pointing to the SQL DB on Machine #1)
Machine #3: Windows 2003 Server w/SSRS only. (pointing to the SQL DB on Machine #1)
Device #1: Arrowpoint load balancer for Machines #2 & #3 (w/sticky sessions).


We recently added 2 web servers and configured them to load balance the web requests to a seperate SQL Server machine. (the load balancing is done thru an Arrowpoint device not Microsoft NLB)

The installation of reporting services (on Machine #2 & #3) went smoothly and the configuration was a breeze. But we could not access the "http://reports.ourdomain.com/Reports" directory for reporting services on the 2 web server machines. We received the "401.1 - Unauthorized" http error.

Since we were using a domain name to access the report server we made sure to update the <URL> tag in the config files.

File location 1:
C:Program FilesMicrosoft SQL ServerMSSQL.2Reporting ServicesReportManagerRSWebApplication.config

<ReportServerUrl>http://reports.ourdomain.com/ReportServer</ReportServerUrl>



File location 2:
C:Program FilesMicrosoft SQL ServerMSSQL.2Reporting ServicesReportServer
sreportserver.config

<UrlRoot>http://reports.ourdomain.com/reportserver</UrlRoot>

We still received the error, so then we added a couple of entries to the HOSTS file on each web server:
File location -->
C:WINDOWSsystem32driversetcHOSTS

In order for the load balancers to "see" themselves from the domain reference we had to update the HOSTS file
on each web server to have the domain name "reports.ourdomain.com" point to the IP Address of the specific web server.
(we also added the IP of Machine #1 just to be safe):

MACHINE #2's HOSTS file:
127.0.0.1 localhost
10.10.0.1 Machine1
10.10.0.2 reports.ourdomain.com #IP of Machine2


MACHINE #3's HOSTS file:
127.0.0.1 localhost
10.10.0.1 Machine1
10.10.0.3 reports.ourdomain.com #IP of Machine3

Then the web servers were able to authenticate the users using IWA and NTLM
and we could access the report servers normally. Even the the scheduled reports
were being load balanced and emailed from the web servers which we didn't
expect to happen. (pretty cool!)