Microsoft Technology, .Net, BizTalk, Sharepoint & etc.

Liedong(Ken) Zheng, Senior SharePoint Developer at SIMPLOT

Archive for May, 2009

Exam 70-568 and 70-569 prep links

Posted by ken zheng on May 31, 2009

Posted in .Net | Tagged: , , | Leave a Comment »

please wait while the installer finishes determining your disk space requirements

Posted by ken zheng on May 21, 2009

When I install AJAX MSI on Windows Server 2008, It pops up with the message “please wait while the installer finishes determining your disk space requirements”, and after a few hours it still told me to wait.

You can run command line to avoid the message:
msiexec /package /qr

this will run the installation with reduced UI.

Posted in Uncategorized | Leave a Comment »

Add the PDB File to the GAC

Posted by ken zheng on May 18, 2009

The PDB file needs to be in the GAC for debugging in Visual Studio. You can add this file through a feature manifest file, but you are unlikely to want to deploy the PDB to the GAC on your production server, so a better way on the dev server is to directly place files in the GAC. To do this, map a drive in windows explorer to

\\[your server name]\c$\windows\assembly

This bypasses the windows explorer shell special handling for this folder, and allows you to copy and paste files as normal without using GACUTIL.

In the GAC_MSIL subfolder, find the subfolder corresponding to the name of your assembly. Below there will be one or more version subfolders. Find the latests version subfolder., and copy your timer job dll and pdb file (built in debug mode!) to this folder.

Posted in Uncategorized | 2 Comments »

Get a copy of dll in GAC (or) add Reference to a dll in GAC

Posted by ken zheng on May 14, 2009

Today I found this blog to show you how to get dll from GAC
you can run
Dot net have a dll file Shfusion.dll which is a Assembly Cache Viewer. It is located in the following path.

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\shfusion.dll

1. uninstall the dll using the following command in the run dialog box.

regsvr32 -u C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\shfusion.dll

1. Now type assembly in the Run dialog box.
2. Now you will see the folder view of the GAC. copy the dll you want.

To get back to the previous state of view register the Shfusion dll using the following command

regsvr32 C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\shfusion.dll

Posted in Handy Tips | 3 Comments »

A simple method to display a list in another site

Posted by ken zheng on May 13, 2009

I found a very useful script which will display a list/document library in another site. See here, and it works for folders in the library as well. Just be aware of WebPartWPQi which is the id in the source list.

Posted in Sharepoint | Tagged: | Leave a Comment »

Incoming email job failed in SharePoint

Posted by ken zheng on May 13, 2009

I got the below errors on the SharePoint Server in every minute. This looked like the incoming email drop folder was not setup properly in the Central Admin Console. We checked and sure enough the drop folder was empty. Setting that value fixed this error. To set the drop folder

Central Admin-> Incoming email settings

Click Advanced and type in the email drop folder.

Event Type: Error
Event Source: Windows SharePoint Services 3
Event Category: E-Mail
Event ID: 6872
Date: 5/25/2008
Time: 9:16:22 AM
User: N/A
Computer:
Description:A critical error occurred while processing the incoming e-mail drop folder.

The error was: Value cannot be null.

Parameter name: path.

For more information, see Help and Support Center at

Event Type: Error
Event Source: Windows SharePoint Services 3
Event Category: Timer
Event ID: 6398
Date: 5/25/2008
Time: 9:16:22 AM
User: N/A
Computer:
Description:The Execute method of job definition Microsoft.SharePoint.Administration.SPIncomingEmailJobDefinition (ID 15cb7ef8-cfa0-4d8e-9892-4deb1c69d0f7) threw an exception. More information is included below.
Value cannot be null.
Parameter name: path

Posted in Sharepoint | Tagged: | Leave a Comment »

Respond to SharePoint Survey by javascript

Posted by ken zheng on May 12, 2009

After one day’s play around, I wrote this javascript which fill in the survey by parse the query string. There is a jquery function ($(‘#aspnetForm’).fadeTo(“fast”,0.33)) to fade the whole page so you can comment it out.

I only used textbox field and checkbox but you can extend the function easily.

<script>

_spBodyOnLoadFunctionNames.push("fillValues");

function fillValues() {
  //jquery to fade opacity
  $('#aspnetForm').fadeTo("fast",0.33)

  var qs = location.search.substring(1, location.search.length);
  // alert(qs);
  var args = qs.split("&");
  var vals = new Object();
  for (var i=0; i < args.length; i++) {
    var nameVal = args[i].split("=");
    var temp = unescape(nameVal[1]).split('+');
    nameVal[1] = temp.join(' ');
    vals[nameVal[0]] = nameVal[1];
    //alert(nameVal[0] + " " + nameVal[1]);
  } 

  if(setTextFromFieldName("Question1", vals["question1"]))
  {
    simulateButtonClick("diidIOSaveItem");
  }
}

function getTagFromIdentifierAndTitle(tagName, identifier, title) {
  var len = identifier.length;
  var tags = document.getElementsByTagName(tagName);

  for (var i=0; i < tags.length; i++) {
    var tempString = tags[i].id;
    if (tags[i].title == title && (identifier == "" || tempString.indexOf(identifier) == tempString.length - len)) {
      return tags[i];
    }
  }
  return null;
}

function setTextFromFieldName(fieldName, value) {
 if (value == undefined) return false;

 var theInput = getTagFromIdentifierAndTitle("input","TextField",fieldName);
 theInput.value=value
 return true;
}

//To use this function: setCheckboxFromFieldName("Checkbox", 0);
function setCheckboxFromFieldName(fieldName, value) {
 if (value == undefined) return;
   var theInput = getTagFromIdentifierAndTitle("input","BooleanField",fieldName);
theInput.checked=value;
}

function simulateButtonClick(name){
  var tags = document.getElementsByTagName("input");

  for (var i=0; i < tags.length; i++) {
   var tempString = tags[i].id;
   if(tempString.indexOf(name)>0)
   {
     tags[i].click();
    }
  }
}
</script>

Posted in Uncategorized | Leave a Comment »

Programatically using OOTB SharePoint Error Handling

Posted by ken zheng on May 8, 2009

To display sharepoint friend error page, you need to change the web.config file and
make sure:

<customErrors mode=”On” />
and
<SafeMode MaxControls=”200″ CallStack=”false” …>

And if you get an error in your custom code that you want to handle using the “out of the box” SharePoint mechanisms, use the following lines of code…

Make sure you only call the ‘TransferToErrorPage’ method if you are handling errors in the a user interface (web part, page, etc…). Don’t call that method in a workflow, event handler, etc…

//This will write to SharePoint’s log files.

Microsoft.Office.Server.Diagnostics.PortalLog.LogString(“Your Error Message”);

//This will redirect you to SharePoint’s error page.

Microsoft.SharePoint.Utilities.SPUtility.TransferToErrorPage(“Message to display on the page”);

Posted in Sharepoint | Tagged: | Leave a Comment »

Hide Action/Setting Menu from SharePoint List

Posted by ken zheng on May 7, 2009

Add below Javascript to a Content Editor Web Part on your List page, (Below your List Web Part) it will hide the both menus.

    <script>
        function HideDiv(name) {
            var div = document.getElementsByTagName('div');
            for (var i = 0; i < div.length; i++) {
                var str = div[i].id;
                if (str.indexOf(name) >= 0) {
                    var viewInExplorer = div[i];
                    if (viewInExplorer != null) {
                        if (viewInExplorer.parentNode != null)
                            viewInExplorer.parentNode.removeChild(viewInExplorer);
                    }
                }

            }

        }

        HideDiv("ListActionsMenu");
        HideDiv("ListSettingsMenu");

    </script>
</script>

Posted in JavaScript, Sharepoint | Tagged: | 1 Comment »

indexing is not running on server 2008

Posted by ken zheng on May 6, 2009

The Indexing Service and the Windows Search Service (Indexing Service’s replacement) are role services in the File Services role. So you have to install that first.

Which indexing solution should I install?
You should install Windows Search Service, unless you have a customized or non-Microsoft application that requires you to run the legacy Indexing Service on your server. Windows Search Service offers several enhancements over Indexing Service, especially in the areas of extensibility, usability, and performance.

Posted in .Net, Handy Tips | Tagged: | Leave a Comment »