puneet's profileAchilles WatchesPhotosBlogListsMore Tools Help

Blog


    SharePoint + This might also be because an indexer move is in progress

    I got this exception while developing on the SharePoint enterprise search.

    "Microsoft.Office.Server.Search.Query.SearchServiceNotFoundException: The search request was unable to connect to the Search Service.
       at Microsoft.Office.Server.Search.Query.FullTextSqlQuery.Execute()
    "
     
    And i could not access the search settings in the shared service provider. I was getting the following message: "The search service is currently offline. Visit the Services on Server page in SharePoint Central Administration to verify whether the service is enabled. This might also be because an indexer move is in progress"
     
    The way to get start back again is to restart the Office Search service. This can be accessed via the "services.msc" in the command prompt. Wink
     
    Thanks,
    Puneet.H

    SharePoint: Web User Control in master pages

     
    I was using the SharePoint designer and instantiated the User Control (placed in CONTROL TEMPLATES) I created for the top navigation bar in the master page.
    Since i was working with the split mode. I didnt see any HTML of the user control in the page. So this is the tricky part, i had not given the id for the instance on the page.
     
    Enjai,
    Puneet.H
     

    SharePoint: Caml Query- Time being ignored

    Hey All,

    Caml query not using the time part in datetime. If your are doing a caml query and you see that your time is being ignored in datetime try this:
    <Value Type=”DateTime” IncludeTimeValue=”TRUE”><Today /></Value>
    You have to use IncludeTimeValue=”TRUE”. Nerd
     
    Found this blog which explained it, and works like a dream. Open-mouthed
     
    Enjai,Hot
    Puneet.H

    "Some or all identity references could not be translated" in SharePoint

     

    I was configuring my WSS 3.0 installation and was getting this exception logged in the eventviewer on every page refresh and getting a message "Some or all identity references could not be translated".

    The solution to this problem was "stsadm.exe -o updatefarmcredentials -userlogin -password".

    Yippee, the central administration came up.  Open-mouthed

     

    Description:

    Failed to register SharePoint services.

    An exception of type System.Security.Principal.IdentityNotMappedException was thrown.  Additional exception information: Some or all identity references could not be translated.

    System.Security.Principal.IdentityNotMappedException: Some or all identity references could not be translated.

       at System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection sourceAccounts, Type targetType, Boolean forceSuccess)

       at System.Security.Principal.NTAccount.Translate(Type targetType)

       at Microsoft.SharePoint.Administration.SPFarm.CurrentUserIsAdministrator()

       at Microsoft.SharePoint.Administration.SPPersistedObject.Update()

       at Microsoft.SharePoint.Administration.SPService.Update()

       at Microsoft.SharePoint.Administration.SPDiagnosticsService.Update()

       at Microsoft.SharePoint.Administration.SPPersistedObject.Update(Boolean ensure)

       at Microsoft.SharePoint.PostSetupConfiguration.ServicesTask.InstallServiceInConfigDB(Boolean provisionTheServiceToo, String serviceRegistryKeyName)

       at Microsoft.SharePoint.PostSetupConfiguration.ServicesTask.InstallServices(Boolean provisionTheServicesToo)

       at Microsoft.SharePoint.PostSetupConfiguration.ServicesTask.Run()

       at Microsoft.SharePoint.PostSetupConfiguration.TaskThread.ExecuteTask()

     

    Enjai,Hot

    Puneet.H 

    MOSS: Configure icons for PDF documents in search results

     
    To configure the icons for PDF documents to show up in search results (read more about configuring MOSS search to index PDF documents) or in the default view of the document library, follow the steps below: 
     
    1. Copy the .gif file to
        SharePoint Server 2007- Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Images
     
    2. Edit the Docicon.xml file to include the .pdf extension. To do this, follow these steps:

     a.  Start Notepad, and then open the Docicon.xml file. The Docicon.xml file is located in one of the following folders on the server:
     SharePoint Portal Server 2003 - Drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\60\Template\Xml
     SharePoint Server 2007- Drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\60\Template\Xml

    b.  Add an entry for the .pdf extension. For example, add a line that is similar to the following to the Docicon.xml file, where NameofIconFile is the name of the .gif file:
    <Mapping Key="pdf" Value="NameofIconFile.gif"/>

    c.  On the File menu, click Save, and then quit Notepad.

    3. Restart the server.

    Enjai Maadi,

    Puneet.H
    AddThis Social Bookmark Button

    MOSS and Searching PDF Documents

     
    I was trying to configure MOSS search to index PDF documents present in the document libraries. Here are the steps:
     
    1. Download Adobe Reader 8.x from here and install it on the server.
    2. Add the filter extension to the File Types crawled:
    Start -> Program -> Microsoft Office Server -> SharePoint 3.0 Central Administration  -> <Name of SharedService Provider> -> Search Settings -> File Types -> New File Type (Add extension  pdf here)
    3. Modify the following registry default values with the new CLSID for the Adobe IFilter:
        {E8978DA6-047F-4E3D-9C78-CDBE46041603} (run regedit in the command prompt )
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office server\12.0\Search\Setup\ContentIndexCommon\Filters\Extension\.pdf
    Default --> {E8978DA6-047F-4E3D-9C78-CDBE46041603} 
     
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Search\Setup\ContentIndexCommon\Filters \Extension \.pdf     Default --> {E8978DA6-047F-4E3D-9C78-CDBE46041603} 
    4. Add the Installation directory of the Adobe Reader v.8 to the System Path. For example, if the Reader is installed on "D:\Program  Files\Adobe", then add "D:\Program Files\Adobe\Reader 8.0\Reader" to the system path by:
               Right Click on My Computer -> Properties -> Advanced -> Environment Variables -> Path (Under System Variables) -> Edit -> (Add "D:\Program Files\Adobe\Reader 8.0\Reader"). 

    5. Restart the search service by running the following commands in the prompt:
    > net stop osearch 
    > net start osearch
    Enjai Maadi,
    Puneet.H

    MOSS 2007 - Create a survey, add question and choices programmatically

     
    I was trying to create an out of the box survey programmatically and wanted to add the question and choices to it too. Below is the sample implementation in C#.
     
                        SPWeb web = SPControl.GetContextWeb(HttpContext.Current);
     
                        // create the out of the box survey using the list template
                        Guid surveyId = web.Lists.Add("Name of the Title", "Description of the survey", SPListTemplateType.Survey);
                       
                        SPList survey = web.Lists[surveyId];
                        
                        string Question = "what?";
                        StringCollection choices = new StringCollection();
                        choices.Add("choice1");
                        choices.Add("choice2");
                        choices.Add("choice3");
     
                        // Set the question and choices for the survey
                        survey.Fields.Add(Question, SPFieldType.Choice, true, false, choices);
                        // save the changes back to the list
                        survey.Update();
                        
                        // save the changes made in the site
                        web.Update();  
     
    Enjai Maadi,
    Puneet.H               

    Chart Web part in MOSS

     
    Found this link which lets you download a chart web part. You can use it as a bar chart or as a pie chart.  Pretty simple and kool web part.
    Check it out at ListCharts - new web part.
     
    Enjai Maadi,
    Puneet.H

    Media player in MOSS 2007

     
    I needed to stream a video file to the client.. say as in streaming a webcast. So we needed to embed a video player in a SharePoint site. I found this link where he has explained the same. It worked for me like a dream.
     
    Add a Content Editor Web Part onto your page, and click on the Source Editor where you could input the following HTML, and update the URL value accordingly.  Parameters could be added or removed according to your needs, refer to w3schools for the parameters available.
     
    <OBJECT id="VIDEO" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject"> 
            <PARAM NAME="URL" VALUE="
    /Docs/[Your Document Library]/[folder]/[your file.wmv]">
            <PARAM NAME="animationatStart" VALUE="true">
            <PARAM NAME="transparentatStart" VALUE="true">
            <PARAM NAME="SendPlayStateChangeEvents" VALUE="True">
            <PARAM NAME="AutoStart" VALUE="false">
            <PARAM name="uiMode" value="full">
    </OBJECT> 
     
    Enjai,
    Puneet.H

    SharePoint - Business Data Catalog walkthrough

     
    I was looking out for some BDC related stuff and for some walkthroughs and tutorials.
    Here is the MS Virtual Lab link to the walkthrough which i found really helpful.  You have to be a MSDN subscriber and a MSN passport account helps.
     
    Also editing the application definition file by hand is a pain. Using BDC MetaMan is advised. You can find it here.
     
    Enjai,
    Puneet.H

    Using SPSecurity.RunWithElevatedPrivileges: Get a File

     
    Well, i had a SharePoint site running Forms Authentication and i had to get a file from the document library for editing. So i decided to give Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges method a try. This takes a void function which will be run in elevated priveleges. So creating/deleting MySite for users while adding them from a legacy system can be done without the application running in System Account.
     
    Heres the sample code:
     
    SPFile rFile;
    SPWeb web;
    using
    (SPSite site = new SPSite(serverurl))
    {
    web = site.OpenWeb();
    // get the file
    SPSecurity.RunWithElevatedPrivileges(GetSPFile);
    // read the file
    StreamReader streamReader =
    new StreamReader(rFile.OpenBinaryStream());
    filecontent = streamReader.ReadToEnd();
    // do some file manipulation
    /*
    .......
    */
    web.AllowUnsafeUpdates =
    false;
    }
     
    private
    void GetSPFile()
    {
    web.AllowUnsafeUpdates =
    true;
    rFile = web.GetFile(strFileURL);
    }
     
    Enjai,
    Puneet.H

    SharePoint 2007 + Blocked File Types

    In order to add or remove a file type being added to your SharePoint portal you will have to add/remove the extension of the file from blocked file types.

    To find out the blocked file types you will have to goto Central Administration -> Operations -> Manage Blocked File Types.

    You will see a list of extensions. In order to remove a file type, delete the file type and click OK.

    In order to block a file type, just add it to the list in a new line and click OK.

    For more information go HERE.


    SharePoint + HTML Editor

    Well, if you wanted a HTML editor in your SharePoint application then read on...
    SharePoint uses a HTML editor present in http://Server:portno/_layouts/htmledit.aspx for its own purposes.
     
    I have put forth the JavaScript code required to popup the HTML editor. I also have to warn that for some reason you are presented with messy JavaScript errors when you try to highlight the text background or change the color of the text.
     
    <script language="javascript">
    function jsPopupEditor()
    {
    var rc = new Array(0,0);
    rc = window.showModalDialog('http://Server:portno/_layouts/htmledit.aspx?Target=hdnTxt',document.getElementById("hdnTxt"),'dialogHeight:450px;dialogWidth:450px;');
    if (rc != null){
    document.getElementById("hdnTxt").innerHTML= rc;
    document.getElementById("hdnTxt").value = rc;}
    }
    </script>
     
    Here hdnTxt is a hidden multiline textbox containing the HTML to be edited.
     
    Enjai,
    -Puneet.H

    SharePoint + Open documents(links) in a new window

    Well to force open the documents(links) in a new window. Get the webpart from here and add it to the document libary page.
    Enjai
     
    -P.H