Tuesday, September 30, 2008

How to move the shared documents between 2 different farm

Finally, I found a easy way to move the shared documents to another farm without lossing the versions, date, owner informations.
Here is the steps.



  1. Create a temp sub-site based from publishing template group within the same web application of shared document.

  2. Use [move] function to move all documents from [Shared Documents] list to temp sub-site. If want keep folder structure, create the same folder structure first and then move.
    [move] function can be found - [site action] - [site settings] - [Modify all site settings] - [Content and structure] - [Actions]

  3. Use stsadm export/import to clone this sub-site to another farm.

  4. Use reverse way to [move] all documents within sub-site to a new [Shared Documents] list.

Friday, September 26, 2008

The depression of missing mobile controls in VS 2008

I did add a user control based oracle gridview page into web part and deployed to sharepoint site.
But met one curious thing, if show the user control on normal web page directly, the paging function running fine. Once running to click page number within web part, it does't work. How depression it is.
It seems I have to use those mobile specially controls to put in the page, not sure if it will be running well in web part. But seems no other better choice.
For now, met another worse thing, that is the mobile control is not default installation within visual studio 2008. That's unacceptable. I always suspected I missed when installation time. But that's not my fault finally.
You have to setup it manually.
Mobile Web Forms in Visual Studio 2008
You can download the mobile templates from the Web Development Tools Team Blog Post .
There is a "readme" file attached to each of the extracted Zip folders. But to make it simpler, once you install and unzip the package, you get a folder "ASP.NET Mobile Templates" and inside that you might find a bunch of folders.

Copy the Zip folders inside each of the "ASP.NET Web Application" Folders into your system's Visual Studio Templates folder. For instance, there is a folder for "ASP.NET Web Application CS". You need to copy the contents of this file into

c:\Documents and Settings\\My Documents\Visual Studio 2008\Templates\ItemTemplates\Visual C#

Similarly you would copy the contents of the "VB" folder into the Visual Basic folder under "ItemTemplates" above.

Once you copy these and restart Visual Studio 2008, you would be able to get the "Mobile Web Form", "Mobile Web User Control" and "Mobile Web Configuration File" under "My Templates" in "Add New Item" Wizard.

Thursday, September 25, 2008

Error handle

When restart vitual server of MOSS setup, it pop up system event error as following:
Event Type: Error
Event Source: DCOM
Event Category: None
Event ID: 10016
Date: 9/25/2008
Time: 8:01:47 AM
User: NT AUTHORITY\NETWORK SERVICE
Computer: MYSHAREPOINT
Description:
The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID
{61738644-F196-11D0-9953-00C04FD919C1}
to the user NT AUTHORITY\NETWORK SERVICE SID (S-1-5-20). This security permission can be modified using the Component Services administrative tool.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


The correct fix steps are:
Copy the GUID following the CLSID above, and Start-->Run-->regedit

With the registry editor open, ensure that your cursor is on the computer at the beginning of the tree (make sure you are not in the middle of some previous edit session in the registry editor).

Edit-->Find and paste in the GUID. It'll stop at the application entry - and you will want to note the application name on the right side pane. In this example, it was the IIS WAMREG admin service that popped up.

Now, open Component Services (typically, from the server - Start-->Administrative Tools-->Component Services), expand Component Services, Computers, My Computer, DCOM Config. Scroll down and find the application (IIS WAMREG in this case). Right-Click-->Properties and select the Security tab. You'll have some options here - the first block Launch and Activation Permissions - ensure that the Customize radio button is selected, and click Edit. Now, add your service account - giving it launch and activate - and in some requirements - remote launch / activate permission.

Restart IIS and continue on.

Friday, September 19, 2008

The key point when use a user control in a web part to compile

You will find the user control always raise the inherit error.
The correct inherit in your ascx file should be like following syntax.
Inherits="UCWebPartSl.WebUCOne, UCWebPartSl, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a01114482a6f77cc"

Monday, September 15, 2008

Debugging the theme by STSDEV

It's great to use Solutionizing .NET STSDEV Theme Solution Generator.
If you want to deploying page based solutions especially for Theme, now there is a great tool you can easy to use it. (download from here http://www.codeplex.com/Solutionizing/Release/ProjectReleases.aspx?ReleaseId=17314)

You can find the snapshot of usage here
(http://solutionizing.net/2008/09/14/stsdev-theme-solution-generator/)


Here I just want to tell you about the debugging.
Once you changed any elements about Theme such as CSS settings(theme.css) or images.
You are not able to see any changes in sites whatever you use the [DebugUpgrage] or [DebugRedeploy] method on STSDEV deployment.
What you need to do is change the theme selections, you will find changes then attach to process "w3wp.exe" for debugging.

A good CSSs reference of theme

http://www.heathersolomon.com/content/sp07cssreference.htm

Friday, September 12, 2008

Use User Control in Web Part (Deploy by STSDEV)

  1. Open STSDEV to create a new project with web part template as snapshot.


  2. Add a User Control in Project.

  3. Create directory structure in project as snapshot.


  4. Change the CustomWebPart1.cs file as following snippet.


    using System;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    namespace UCWebPartSl
    {
    public class CustomWebPart1 : WebPart
    {
    UserControl userControl;
    protected override void CreateChildControls()
    {
    //Label lblHello = new Label();
    //lblHello.Text = "Hello";
    //Controls.Add(lblHello);
    base.CreateChildControls();
    userControl =(UserControl)Page.LoadControl(@"/_controltemplates/WebUCOne.ascx");
    this.Controls.Add(userControl);
    }
    protected override void Render(HtmlTextWriter writer)
    {
    //base.Render(writer);
    userControl.RenderControl(writer);
    }
    }
    }


  5. Change the "Inherits" in WebUCOne.ascx file as following snippet. This assembly can be fetch by Reflector tool.
  6. Build on "DebugDeploy" mode.
  7. Activate the web part feature in Site Collection Features management page.
  8. Add web part to any page as snapshot.


    Use User Control in Web Part (manually deploy to 12 hive system)

    Refer "Use User Control in Web Part (manually deploy to Inetpub)".
    Just need adjust below project directory and snippet. And copy ascx file to 12 hive\TEMPLATE\CONTROLTEMPLATES


    Use User Control in WebPart (manually deploy to Inetpub)

    Talked with 黎明 (msn group's friend) last night about his new creative about moss webpart experiences. That is User Control usage in Web Part. I adviced him to write it down to something like blog. He told me he did never write that. For a technical deposit. I draft that here.
    1. Create User Control.

    Create a C# Web Application by VS 2008

    Add new User Control as you like show and compile it. Snapshot show you how it looks like.



    2. Add existing user control to a web part and deploy web part.


    1. Create a new web part by wss extension of vs 1.2

    2. Create a new folder "wpresources" in project. And add existing ascx file in this folder.



    3. Change web part CS file as below snappit.


    4. namespace UCPart{
      [Guid("c60b2566-0113-490a-9581-8ecbac96a81a")]


      public class WebPart1 : System.Web.UI.WebControls.WebParts.WebPart
      {


      public WebPart1()
      {
      }


      UserControl userControl;


      protected override void CreateChildControls()
      {
      base.CreateChildControls();
      userControl =
      (UserControl)Page.LoadControl(@"/wpresources/WebUCOne.ascx");
      this.Controls.Add(userControl);
      }


      protected override void
      Render(HtmlTextWriter writer)
      {
      //base.Render(writer);
      userControl.RenderControl(writer);
      } }}



    5. Change AssemblyInfo.cs file to add "using System.Security;" to the using part and add below snippet to the last row.
      [assembly: AllowPartiallyTrustedCallers]

    6. Change C:\Inetpub\wwwroot\wss\VirtualDirectories\portal.mysharepoint80\Web.Config file. Add SafeControl and change Trust Level as below




    7. Change the output path of project properties to

      ..\..\..\..\..\Inetpub\wwwroot\wss\VirtualDirectories\portal.mysharepoint80\bin\

    8. Build the project and copy WebUCOne.ascx file to folder

      C:\Inetpub\wwwroot\wss\VirtualDirectories\portal.mysharepoint80\wpresources

    9. Run "iisreset -noforce" on command line

    10. Open [portal] -[site action]-[Gallery]-[Web Part Gallery]-[New], find the one you created and click [Populate Gallery].

    11. Add this web part to any page to show.