Wednesday, February 29, 2012

Microsoft’s PowerPivot v2 Issue


New Version of PowerPivot V2 for SQL Server 2012 has been released.

And since not everyone knows that “2012 RC0” means “test version that won’t work with your servers, or anyone using v1” and that “2008 R2” means “version 1, the one you need for production environments,” well, this could still use some serious clarification.


That’s not a big deal except for:
  1. The release candidate likely isn’t as stable as the most up-to-date release of PowerPivot v1
  2. Workbooks created in v2 CANNOT be opened by v1, and that includes v1 server!
  3. There is no way to “downgrade” a v2 workbook to v1, so if you want to use a v2 workbook on v1, you have to start over
So be careful – v2 is awesome but using it unknowingly may have side effects you didn’t expect, at least until v2 is official released and the rest of your organization upgrades.
I’ve notified MS of this problem but so far they haven’t fixed it. Both v1 AND v2 should be available for download, with v1 the default, and both clearly marked.
If you want to download v1, here is the link:

Friday, February 24, 2012

Hide "Send To" Menu Item option in a documents context menu

Hide "Send To" option in a documents context menu. Add CEWP on document library view page and the below script to it.

<script type="text/javascript">
 _spBodyOnLoadFunctionNames.push("resetAddSendSubMenu()");

 function resetAddSendSubMenu()
{
   AddSendSubMenu = function (m,ctx) {};
 }
</script>

It turned out to be very simple by doing this:
  1. Go to the document’s view url, for example: http://example.com/Documents/Forms/AllItems.aspx.
  2. If it is a web part page, edit the page and add a Content Editor web part. Otherwise you need to edit that page in SharePoint Designer.
  3. Open the source editor (not the rich editor) for the Content Editor web part, or open the code view (not the design view) of that particular page in SharePoint Designer.
  4. Either inside the web part or the code view, insert the following script:
<script type=”text/javascript”>
AddSendSubMenu = function (m,ctx) {}
< /script>


Read more: http://www.information-worker.nl/2009/09/02/remove-send-to-menu-option-in-sharepoint-document-library/#ixzz1nKqK3mrv

Remove the recently modified link in Quick Launch

In SharePoint 2010 we all are familiar with the following annoying quicklaunch menu:
image
In SharePoint 2010, the recently modified items is one of many less-used feature. In software industry we are familiar with 80-20 principal. If 80% custom wants a feature then we should go with it and if you can satisfy 80% users then you have the successful product. I guess the ‘Recently Modified’ quick link doesn’t even needed by 10% people but the link is enable by default. Maybe this is a security feature to let administrator know what files have been modified recently. But there should have an on/off option as this is less wanted feature and most of the administrators want to hide this link. Justin has already found a way to hide the option by modifying template file as described in his blog. However, we can fix the issue without modifying the shared file. Specially in case of shared hosting we don’t want to modify the files from 14 hive. The two approaches described here is implemented by modifying master page. The first approach is acceptable but may have unknown side effects. On the other hand second approach is much better and less chance of side effects.

First solution:

1. Open your master page (default one is V4.master) and find the content place holder ‘PlaceHolderLeftActions’ as shown below:
<asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat="server">                
</asp:ContentPlaceHolder>
2. Now set the content place holder visible property to false. as shown below:
<asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat="server" Visible="false">            
</asp:ContentPlaceHolder>

Why it works?
The above trick works as in the aspx files the recently changed menu is put inside the placeholder. If you open a file in SharePoint Designer you can find that the recently modified menu is put under the placeholder with id ‘PlaceHolderLeftActions’ as shown below:
<asp:Content ContentPlaceHolderId="PlaceHolderLeftActions" runat="server">
    <SharePoint:RecentChangesMenu runat="server" id="RecentChanges" />
</asp:Content>

Warning
The content placeholder ‘PlaceHolderLeftActions’ mainly used in blog and wiki sites. So if you are using any of this kind of template then hiding the content place holder will hide others related links too. However, I have found that hiding the content placeholder in team site works perfectly.

Second and Better Solution

However, the above trick may have side effects, if the same place holder (‘PlaceHolderLeftActions’) is used by other pages. Another solution (which I think less side effects or no side effects) is to apply a css. As shown in the following screen, the ‘recently modified’ quick launch uses a css class named ‘s4-recentchanges’ (shown with firebug).
image
So we can another property ‘display:none’ to the same css class by adding the following extra attribute to master page’s header section:
<style type="text/css">
    .s4-recentchanges
    {
        display:none;
    }
</style>
You can even put the above section in a css file and refer the file in master page. The following image shows the master page with the css class:

image

Hide NEW document symbol in green color

I have form library in sharepoint 2010. In that library list workflow is associated. Whenever any document is added to the library, new document symbol in green color is appearing behind the document. We can Remove that option using STSADM Commancd.

 stsadm -o setproperty -pn days-to-show-new-icon -pv 0 -url [Your Virtual Server's URL] 

Ex: stsadm -o setproperty -pn days-to-show-new-icon -pv 42 


http://technet.microsoft.com/en-us/library/cc287681%28office.12%29.aspx


How To Hide The Add Document Or Add New Item

This is a simple workaround and I saw a request a couple days back asking to hide the Add Document link after the list of items. In fact, the Add Document may encourage users to upload files from their computers rather than use the create new (select content type). Plus, you still have the upload document or multiple documents from the ribbon.
There are a few ways to do that, one of which is using the browser only – add a CEWP and hide the link using CSS (see this thread for more). A similar approach is to use JQuery and hide the cell that has the Add Document link (again, you add a CEWP, reference the JQ library and add the script (something like $(document).ready(function() { $(‘#WebPartWPQ2 .ms-addnew’).hide();});). If you are doing this on the All Items view page, you will notice that the document library web part loses focus and you have to click inside to show the Library Tools ribbon and switching between views is not as easy as it should be. This is because we have two web parts in the page (even if you hide the CEWP, which you should any way – just check the Hidden property under Layout). It turns out there is another easy and better way – customize the xslt in SharePoint Designer. Select the library (site objects – lists and libraries) and click the view you want to edit (top right). If you want to modify the number of items per page, do it first: List View Tools – Options – Paging (this is not required but if you do it later you will overwrite your custom view).
Now highlight the text “Add Document” and from Design tab (under list view tools), Actions group, select customize item (click the arrow next to customize xslt). Then, switch to code view. The source view should increase by around 80 lines (starts with &lt;xsl&gt;). Locate the line taht starts with &lt;td class=”ms-addnew” and change its style to display:none
Save your page in SPD and check it back in the browser. The Add Document is no longer visible and the view functions as usual.
Note1: If all you have is a web part, you can also set Toolbar Type to “No Toolbar” in the web part properties and that will remove the Add Document.

Wednesday, February 22, 2012

Use a list in a Web Part on any page in your site

You have proudly created a list with many assorted views. People love it so much they want the list for their sites in the same site collection. Trouble is, it’s not easy to make another list show up on other sites these days. You could use REST (Representational state transfer) or even Web services, but you don’t quite have the skills to do that. Fortunately, there’s another approach that’s much easier. All you have to do is save your list as a Web Part and then add the Web Part to any other page on your site. It’s surprisingly easy to do and doesn’t require any code. In the following example, I’ll assume you are working with a typical customer list.

Part 1: Save the List View to a Web Part file

  1. In the browser, go to the list and display the default view.
  2. To open the list in SharePoint Designer, in the ribbon, on the List tab in the Manage Views group, click the arrow next to Modify View, and then select Modify in SharePoint Designer (advanced).
  3. In SharePoint Designer, position the insertion point on any part of the list.
  4. Do one of the following:
    • If you have contribute permission and want to save the Web Part as a file, in the ribbon, click the Web Part tab, and in the Save Web Part group, click To File, click Save, enter a meaningful Web Part filename, such as Customers.webpart, and then click Save.
    • If you have site-level permissions and want to add the Web Part to the site Web Part gallery, in the ribbon, click the Web Part tab, and in the Save Web Part group, click To Site Gallery, click Save, enter a meaningful Web Part filename, such as Customers, and then click OK.
  5. When SharePoint Designer displays the following message:
  6. Click Yes. This ensures the list is accessible from any site of the current site collection.

Part 2: Add the Web Part to another page
  1. Go to the site you want to add the Customers Web Part to, click Site Actions, click New Page, enter Customers List in the New page name box, and then click Create.
  2. Do one of the following:
    • Add the Web Part from a file
      1. Under the Editing Tools tab group, click the Insert tab, and then in the Web Parts group, click Web Part.
      2. To make the Customers.webpart available to the page for insertion, click the arrow next to Upload a Web Part, click Browse, locate and select the Customers.webpart file created in Step 4 of Part 1, click Open, click Upload.
      3. Under the Editing Tools tab group, click the Insert tab, and then in the Web Parts group, click Web Part.
      4. Under Categories, click the newly created Imported Web Parts folder, under the Web Parts section, select Customers.webpart, and then under the About the Web Part section, click Add.
    • Add the Web Part from the Web Part Gallery
      1. Under the Editing Tools tab group, click the Insert tab, and then in the Web Parts group, click Web Part.
      2. Under Categories, click Miscellaneous folder, under the Web Parts section, select Customers.webpart, and then under the About the Web Part section, click Add.
  3. If you see an Information dialog box, entitled, Message from Web Page, ignore it, and then click OK.
  4. Click the arrow next to the Web Part menu, and then click Edit Web Part.
  5. In the Tool Pane, consider doing the following:
    • If you want a different view than the default view to display, under Selected View, select the view you want.
    • If you want to remove the Add New Item link at the bottom of the list, Under ToolBar Type, click No Toolbar.
    • If you want the List View Web Part to look like a regular list, In the Appearance section, under Chrome Type, click None.
  6. Click OK.
  7. In the ribbon, click the Page tab, and then click Save & Close.  

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!)