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

Liedong(Ken) Zheng, Senior SharePoint Developer at SIMPLOT

Archive for May, 2008

SharePoint Server 2007 Best Practices Book Coming Soon

Posted by ken zheng on May 31, 2008

Microsoft Office SharePoint Server 2007 Best Practices book, published by Microsoft Press. This book will give the SharePoint community a starting point for best practice, design and architecture discussions.

Microsoft SharePoint 2007 Unleashed is a worth reading book as well

Posted in Sharepoint | Leave a Comment »

Convert String[] to String

Posted by ken zheng on May 28, 2008

String.Join. This method can take a string array and a separator and then return that as a single string

// First Convert the long array to string arrayString[] strArray = Array.ConvertAll<long, string>(lngArray, new Converter<long, string>(delegate(long lNum) {return lNum.ToString();}));

 

// Now use the String.Join to get a comma seperated list of the array’s items

string strArrayList = String.Join(“,”, strArray );

Posted in Sharepoint | Leave a Comment »

Convert String [] to String

Posted by ken zheng on May 28, 2008

String.Join. This method can take a string array and a separator and then return that as a single string.

                    String author;
                    if (object.ReferenceEquals(da["Author"].GetType(), typeof(String[])))
                    {
                        author = String.Join(” “, (String[])da["Author"]);
                    }
                    else
                    {
                        author = da["Author"].ToString();
                    }

or

// First Convert the long array to string array

String[] strArray = Array.ConvertAll<long, string>(lngArray, new Converter<long, string>(delegate(long lNum) {return lNum.ToString();}));

 

// Now use the String.Join to get a comma seperated list of the array’s items

string strArrayList = String.Join(“,”, strArray );

Posted in .Net | Leave a Comment »

Creating MOSS 2007 Theme

Posted by ken zheng on May 27, 2008

Greate Post from Creating Themes in MOSS 2007

 

  1. On the SharePoint server go to the Themes folder e.g. c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\Themes
  2. Make a copy one of the existing theme folders and its contents rename it e.g. MyTheme.
  3. Rename the .INF file within the MyTheme folder to MyTheme.INF
  4. Edit MyTheme.INF.
    1. At the info section, Change the title, to MyTheme. Change codepage, e.g 22200, replacing the code page will fixing error “A theme with the name “MyTheme 1011″ and version already exists on the server.”
    2. In the titles section, rename the names to your new name. this section is to present the name in the different language.
  5. Provide an image to give a preview of your theme. This image should be placed in C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\IMAGES. E.g. tmbMyTheme.gif
  6. Modify the c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\Layouts\1033\SPTHEMES.xml to include a reference to the new MyTheme theme

    <Templates>
    <TemplateID>MyTheme</TemplateID>
    <DisplayName> MyTheme </DisplayName>
    <Description> MyTheme has a white background with blue control areas and orange highlights.</Description>
    <Thumbnail>images/tmbMyTheme.gif</Thumbnail>
    <Preview>images/ tmbMyTheme.gif</Preview>
    </Templates>

  7. Modify the CSS within MyTheme folder to personalize your theme.
  8. Run iisreset from the command prompt
  9. Apply the new theme to a “test site”,.

Posted in Sharepoint | Tagged: | Leave a Comment »

Silverlight Blueprint for SharePoint

Posted by ken zheng on May 27, 2008

Silverlight Blueprint for SharePoint site: http://www.ssblueprints.net/sharepoint/ !

 You can read more details on Patrick’s blog and Karine’s blog (she posted some screenshots). The Blueprint will also be announced by Bill Gates during the SharePoint Conference keynote later today, the SharePoint team blogged about the other announcements as well (SharePoint Online and Microsoft Search Server 2008 Epxress).

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

Steps to add properties to advanced search

Posted by ken zheng on May 27, 2008

1. Make sure you are on the Advanced Search page. Now, from the Site Actions, select Edit Page.

2. Click the edit link and select Modify Shared Web Part.

3. In the Advanced Search Box,

Click the Scopes and tick the show the scope picker box

expand Properties by clicking the + sign.

4. Click anywhere in the Properties box, a blue shaded “square” button (ellipsis) will appear. Click this button to view the content of the Properties box in an editor. You will see that the editor contains lot of text and there are quite a few sections in the code. We need to add the “Keywords” property to some of these sections in order to make it appear in the advanced search box properties.

5. Locate the <PropertyDefs> tag in the text and add the following property definition tag inside <PropertyDefs> and </PropertyDefs> tags.

<PropertyDef Name=”Tags” DataType=”text” DisplayName=”Tags”/>

6. Locate the tag <ResultTypes>. There is another tag inside this tag:

<ResultType DisplayName=”All Results” Name=”default”>

Add the following property reference tag just before the </ResultType> tag:

<PropertyRef Name=”Tags” />

7. Click OK to close the editor.

8. Click Apply and then OK to save the web part changes.

9. Click the Publish button to save your changes.

10. Now, go to the Advanced Search Page and search your documents using the keywords. 

You need to add knowledge scope into advanced search group by:

1.    In your browser, navigate to your site’s home page.

2.    Click the Site Actions link, and then in Site Settings, click Modify All Site Settings.

3.    In Site Collection Administration, click Search scopes.

4.    Click Advanced Search to open the Edit Display Group page.

5.    In the Scopes section, select Display for Knowledge.

6.    Click OK to save your changes. 

Posted in Sharepoint | Tagged: | 4 Comments »

Display a Search Scope in the Search Box and Advanced Search Web Parts

Posted by ken zheng on May 27, 2008

To add the Products search scope to the scopes drop-down list for the Search Box Web Part

  1. In your browser, navigate to your site’s home page.
  2. Click the Site Actions link, and then in Site Settings, click Modify All Site Settings.
  3. In Site Collection Administration, click Search scopes.
  4. Click Search Dropdown to open the Edit Display Group page.
  5. In the Scopes section, for Products, select Display.
  6. Click OK to save your changes.

To add the Products search scope to the displayed scopes for the Advanced Search Web Part

  1. In your browser, navigate to your site’s home page.
  2. Click the Site Actions link, and then in Site Settings, click Modify All Site Settings.
  3. In Site Collection Administration, click Search scopes.
  4. Click Advanced Search to open the Edit Display Group page.
  5. In the Scopes section, select Display for Products.
  6. Click OK to save your changes.

Posted in Sharepoint | Tagged: | Leave a Comment »

Change the View Profile URL

Posted by ken zheng on May 26, 2008

 

Click the View Profile to edit the link

 

Update the URL to https://beta.readify.net/KnowledgeFramework/{0}?eventID={1} and set TypeURL as the first Parameter and EventID as the Second one.

 

Then do a full crawl.

 

 

Posted in Sharepoint | Leave a Comment »

Adding a Default Action to a Business Data Catalog Entity

Posted by ken zheng on May 26, 2008

 A default action is the URL, that will be used when a user clicks for details on the item (either in a BDC webpart or Enterprise Search results).  I personally discovered it because I saw an attribute in an example somewhere that had nothing to do with this topic.  First, I’ll go back and explain how to create an action to begin with.  Most BDC tools will do this for you now, but what does it actually emit in the XML?  Also of note, a lot of tools will let you create the action but not set it as a default.  Here is what typical XML looks like.  It goes in the Entity element.

<Actions>

  <Action Position=1 IsOpenedInNewWindow=false Url={0} ImageUrl=“” Name=Default>

    <ActionParameters>

      <ActionParameter Name=SiteUrl Index=0 />

    </ActionParameters>

  </Action>

</Actions>

The URL allows you to inject the value of a column similar to that of String.Format() using {0} etc.  This can be useful if you need to specify a different protocol besides http (i.e.: file://) or if you needed to construct the URL using multiple columns.  To set up a default action, you need to take a note of what you named the action (in this case I called it Default).  This is how you tell it which action to use as a default.

Now that we have recapped how to create an Action, we need to specify that its a default action.  This is actually pretty easy.  Create a new Property element in the Properties element of the Entity.  Give it an attribute of DefaultAction and specify the name of the Action we defined earlier.  Here is how it looks.

<Property Name=DefaultAction Type=System.String>Default</Property>

When you import the application definition, you will receive a warning like the following. 

 Could not create profile page for Entity MyEntity.  The error is: Default action exists for application ‘MyInstance’, entity ‘MyEntity’.  Profile page creation skipped.

This really isn’t an error.  It is just telling you that since you specified a default action, it did not automatically generate a profile page for the entity. That’s all there is to it.  Hopefully, more tools will start supporting it out of the box soon.

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

Change BDC ADF Version Numbers

Posted by ken zheng on May 26, 2008

If you’re hand-coding ADF files and doing a lot of code/import/test cycles, use the version number to make your life easier. 

I hate to admit it, but until this week, I was always deleting the ADF and re-importing it.  This would break my business data columns and make me re-wire them.  All unnecessary.

File this under “it’s obvious once you see it”.

Example:

<LobSystem
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://schemas.microsoft.com/office/2006/03/BusinessDataCatalog BDCMetadata.xsd"
  Type="WebService"
  Version="1.2.0.0" Name="xyzzyDocumentReview"
  xmlns="http://schemas.microsoft.com/office/2006/03/BusinessDataCatalog">

Change that version and re-import and the existing business data column uses the updated version automatically with no additional configuration required.

 

Posted in Sharepoint | Tagged: , | 2 Comments »