Sharepoint Insight by Namwar Rizvi

Sharepoint Tips, Tricks and inside knowledge from real world experience by Namwar Rizvi

Archive for the ‘Uncategorized’ Category

User Profile Import is not updating changes in Manager property of Active Directory

Posted by namwar on May 25, 2009


Some of you might have experienced an issue that if you update manager  property of any user in Active Directory, it does not get reflected in SharePoint Profile Import. This issue has been identified as a bug in Profile Import and can be fixed by Installing Service Pack 1 of MOSS/WSS.

The reason behind this bug is that SharePoint Profile Import does not detect change in Manager property due to some weired reasons.

If you can not install service Pack 1 then you can fix it by implementing a workaround as follows:

  1. Open SharePoint Central Administration
  2. Navigate to your SharedService Provider e.g. SharedServices1
  3. Under User Profiles and MySites click User Profiles and Properties
  4. Under User Profile Properties , click View profile properties
  5. Click New Property
  6. Add ModifyTimeStamp property and map it to ModifyTimeStamp property of Active Directory.
  7. Click OK
  8. Perform Full Import of user profile
  9. Perform Full Crawl and you are done!
Advertisements

Posted in Uncategorized | 1 Comment »

Display “! Updated Today” indicator just like “! New” icon in Document Library

Posted by namwar on March 1, 2009


One of my cliens wanted to display “! Updated Today” icon (just like New icon) against all of those documents which are updated today so that their users can easily identify these documents. Since the customer just wanted this behaviour in some of the document libraries instead of all of them therefore, I opted to update the “AllItems.aspx” in Sharepoint Designer. By using a few lines of xsl code, I was able to achieve it. Following is the step-by-step procedure:

  1. Open the target page (normally it will be “AllItems.aspx”) in Sharepoint Designer
  2. Right click the ListViewWebPart and select Convert to XSLT Data View”
  3. context-menu

  4. Switch to Code view and search for 
    <xsl:if test="ddwrt:IfNew(string(@Created))"><IMG SRC="/_layouts/1033/images/new.gif" alt="New" /></xsl:if> 
  5. press Enter after the closing tag of above line i.e.  </xsl:if>
  6. Insert the following lines 
  7. <xsl:if test=”ddwrt:FormatDate(string(@Modified), number($Language), 1)=ddwrt:FormatDate(ddwrt:TodayIso(), number($Language), 1)”>

    <xsl:if test="ddwrt:FormatDate(string(@Modified), number($Language), 1)!=ddwrt:FormatDate(string(@Created), number($Language), 1)">

    <span style="background-color:maroon;color:white"> ! Updated Today</span>

    </xsl:if>

    </xsl:if>

     

  8. Save the file and refresh your browser.Bingo!  you will start getting “! Updated Today” indicator against all those files which are updated today similar to following:
  9. document-library1

Posted in Uncategorized | 8 Comments »

Launch Office Application from SharePoint Portal Page

Posted by namwar on February 26, 2009


Business Problem:

    One of my client wanted to have links on main portal to launch Microsoft Office key applications i.e Word, Excel, Power Point and Outlook directly by clicking on a link at portal page.

Solution:

I searched the net and find a nice solution here It is a small piece of JavaScript code which you can put in CEWP and use it on your portal page. I added some formatting and relevant icons against the office applications and wraps it up in a webpart dwp file. After importing this web part on your page, you will get something like this:

launchofficeapplication1

You can download the dwp file from here

Posted in Customization, JavaScript, Uncategorized | Tagged: , , , , | 3 Comments »

Add Custom context menu by Javascript in SharePoint

Posted by namwar on February 19, 2009


If you want to add a custom menu item in Document Library’s item context menu just by Javascript without going into the details of  adding any new feature or writing your own assembly then here is a quick trick:

  1. Add a new Content Editor Web Part on your target page
  2. Open the tool pane of the web part
  3. Click Source Editor and add following Javascript code in it
    <script language="javascript">
    function Custom_AddDocLibMenuItems(m, ctx)
    {
      var strDisplayText = "Say Hello World!";
      var strAction = "alert('Hello World')";
      var strImagePath = "";
     
      // Add our new menu item
      CAMOpt(m, strDisplayText, strAction, strImagePath);
     
      // add a separator to the menu
      CAMSep(m);
     
      // false means that the standard menu items should also be rendered
      return false;
    }
    </script>
    
  4. Click Save
  5. Click OK in toolpane to close it
  6. Now open the context menu of an item of the document library and you will see your new menu item in it similar to following

javascript-custom-menu

Please note that this menu item will only be visible on your target not on every page of your document libraries.

Posted in Uncategorized | Tagged: , | Leave a Comment »

How to fix Cannot run Windows SharePoint Services on this page?

Posted by namwar on February 3, 2009


If you are getting “Cannot run Windows SharePoint Services on this page…” error while trying to upload multiple files in Sharepoint and you are banging your head against the wall then don’t worry you are not alone 🙂 It is the shared pain by many of us facing the legacy errors of FrontPage Server extensions in Sharepoint. This error occurs if you modify Upload.aspx located in layouts folder. First and foremost, do not modify the standard upload.aspx or any other standard file in Sharepoint as it is not supported by Microsoft and your change will be overwritten by any new service pack or hot fix.

So having said that, if you have made a copy of upload.aspx, customized it and trying to use it then you may certainly face this error. Following is the solution to fix it:

  1. Open your copy of upload.aspx and search for 
    <input TYPE="hidden" NAME="_charset_" VALUE="utf-8"><!--webbot bot="FileUpload" endspan i-checksum="45034" -->
  2. Update the following string as follows
    <input TYPE="hidden" NAME="Cmd" VALUE="Save"><!--webbot bot="FileUpload" endspan  -->
  3. Save your file.
  4. Reset IIS
  5. Try to use the file in Sharepoint and Bingo!!!! no more error :):):)

Posted in Uncategorized | Tagged: , , , , | 9 Comments »

How to get all available search contexts for the current site collection?

Posted by namwar on January 26, 2009


If you want to retrieve all available search contexts for the web site collection where your application is initiated then you can use the following code to get it

SearchContext searchContext = SearchContext.GetContext(ServerContext.Current);

Posted in Uncategorized | Leave a Comment »

SQL Server 2005 Service Pack 3 and Sharepoint 2007

Posted by namwar on January 1, 2009


If you are using Sharepoint 2007 to manage and display your reports then there is a big chance you may be using Reporting Services in Sharepoint Integrated mode. You may have noticed that reports run slower in Sharepoint integrated mode as compared to native mode. This is because of the calls to Sharepoint object model in integrated mode. To improve the performace Microsoft has released some optimizations in Service Pack 3 of SQL Server 2005 which reduces the number of calls to object model and increases the overall response  time and performace.

Happy New Year to all readers and best wishes for 2009!

Posted in Uncategorized | Tagged: , , | Leave a Comment »

How to get rid of Login prompt while opening documents in Microsoft Office

Posted by namwar on July 18, 2008


If you are using Sharepoint as your document repository, you may came across with a situation where your users are prompted for login credentials whenever they try to open any document of document library in Microsoft Word. This is very irritating and can ruin the objective of user productivity.

You can resolve this issue very easily. It happens actually if your Sharepoint site is not in the trusted zone of IE. You can verify this by looking at the bottom right of your browser window as follows:

Internet zone icon

If you see the word “local intranet” or “Trusted sites” then only you can open your documents without getting prompt of login credentials. Just add your Sharepoint site into the “Trusted sites” zone and bingo! MS Word will stop prompting you for your credentials. Enjoy!

Posted in Security, Uncategorized | Tagged: | 4 Comments »