Wednesday, December 24, 2008

How to delete master page from Master Page Gallery

As title description, you will find the window pops up the error message as following:
This item cannot be deleted because it is still referenced by other pages.
The delete method:
  1. Open Site Action-Master Page Gallery, click New -Folder to create a new temp folder.
  2. Open the site by SharePoint Designer, click left tree menu to open _catalogs\masterpage, and drag the master file into the temp folder.
  3. Back to IE-Master Page Gallery and press F5 to refresh and then dropdown the temp folder and click [Delete].
  4. Back SharePoint Designer and press [Delete] button to delete the temp folder and press F5 to refresh.

Wednesday, December 17, 2008

Update the Theme CSS immediately.

Once you are doing change css for a page redering to see, you will find it doesn't work immediately if you change something in theme.css or mossExtension.css.

The way to make it works is doing iisreset, it's a permanent change.
You can use SharePoint Designer to open another temporary file named like Xxxx1011-65001.css which is merged by both of theme.css and mossExtension.css. This file is under _themes\yourthemefolder.

It will be available immediately.

RegistrationId List Template Type IDs

RegistrationId List Template Type IDs
InvalidType = -1
GenericList = 100
DocumentLibrary = 101
Survey = 102Links = 103
Announcements = 104
Contacts = 105
Events = 106
Tasks = 107
DiscussionBoard = 108
PictureLibrary = 109
DataSources = 110
WebTemplateCatalog = 111
UserInformation = 112
WebPartCatalog = 113
ListTemplateCatalog = 114
XMLForm = 115 (InfoPath Forms Library)
MasterPageCatalog = 116
NoCodeWorkflows = 117
WorkflowProcess = 118
WebPageLibrary = 119
CustomGrid = 120
DataConnectionLibrary = 130
WorkflowHistory = 140
GanttTasks = 150
Meetings = 200
Agenda = 201
MeetingUser = 202
Decision = 204
MeetingObjective = 207
TextBox = 210
ThingsToBring = 211
HomePageLibrary = 212
Posts = 301
Comments = 302
Categories = 303
Pages = 850
IssueTracking = 1100
AdminTasks = 1200
Translation Management Library = 1300
Languages & Translations = 1301

Monday, December 8, 2008

How to remove the site theme from site settings

After you deployed custom theme by STSDEV and then retract and delete the solution.

You will find it will still exist on site settings-site theme (http://mysharepoint/_layouts/themeweb.aspx)

To remove it, open the file C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\SPTHEMES.XML , find the corresponding templates and delete it.

You will see it disappear from the theme management after iisreset.

STSDEV with Theme function error handle

When you first time to create a solution for theme definition by STSDEV theme version. You might be see the error message when do a deployment as following:
The 'ReceiverAssembly' attribute is invalid.

The steps to fix this issue:

  1. Install Reflector and running it. ( If there's not already, you are going to download it from http://www.red-gate.com/products/reflector/)
  2. Run reflector and open the directory which host solution dll file. (Your solution folder\bin\Debug) And drag the dll into the reflector panel and then click the new added one.
  3. Copy the name string from bottle panel of reflector and paste into "ReceiveAssembly item" of file feature.xml.

Tuesday, November 25, 2008

Most simple site definition master page. (Fix error)

When edit a most simple webpart page, you got error as following desc:

The system cannot find the file specified. (Exception from HRESULT: 0x80070002)

You will find the page element is right AuthoringContainer, remove the corresponding item in masterpage as following:


<PublishingWebControls:AuthoringContainer id="authoringcontrols" runat="server" >
<PublishingConsole:Console runat="server" / > </PublishingWebControls:AuthoringContainer>


The final most simple masterpage will be :

<%-- Identifies this page as a .master page written in Microsoft Visual C# and registers tag prefixes, namespaces, assemblies, and controls. --%>
<%@ Master language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="wssuc" TagName="Welcome" src="~/_controltemplates/Welcome.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="DesignModeConsole" src="~/_controltemplates/DesignModeConsole.ascx" %>
<%@ Register TagPrefix="PublishingVariations" TagName="VariationsLabelMenu" src="~/_controltemplates/VariationsLabelMenu.ascx" %>
<%@ Register Tagprefix="PublishingConsole" TagName="Console" src="~/_controltemplates/PublishingConsole.ascx" %>
<%@ Register TagPrefix="PublishingSiteAction" TagName="SiteActionMenu" src="~/_controltemplates/PublishingActionMenu.ascx" %>
<%-- Uses the Microsoft Office namespace and schema. --%>
<html>
<WebPartPages:SPWebPartManager runat="server"/> <SharePoint:RobotsMetaTag runat="server"/>
<%-- The head section includes a content placeholder for the page title and links to CSS and ECMAScript (JScript, JavaScript) files that run on the server. --%>
<head runat="server">
<asp:ContentPlaceHolder runat="server" id="head">
<title>
<asp:ContentPlaceHolder id="PlaceHolderPageTitle" runat="server" />
</title> </asp:ContentPlaceHolder> <Sharepoint:CssLink runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server" />
</head>
<%-- When loading the body of the .master page, SharePoint Server 2007 also loads the SpBodyOnLoadWrapper class. This class handles .js calls for the master page. --%>
<body onload="javascript:_spBodyOnLoadWrapper();">
<%-- The SPWebPartManager manages all of the Web part controls, functionality, and events that occur on a Web page. --%>
<form runat="server" onsubmit="return _spFormOnSubmitWrapper();">
<wssuc:Welcome id="explitLogout" runat="server"/>
<PublishingSiteAction:SiteActionMenu runat="server"/>
<%-- The PlaceHolderMain content placeholder defines where to place the page content for all the content from the page layout. The page layout can overwrite any content placeholder from the master page. Example: The PlaceHolderLeftNavBar can overwrite the left navigation bar. --%> <asp:ContentPlaceHolder id="PlaceHolderMain" runat="server" />
<asp:Panel visible="false" runat="server">
<%-- These ContentPlaceHolders ensure all default SharePoint Server pages render with this master page. If the system master page is set to any default master page, the only content placeholders required are those that are overridden by your page layouts. --%>
<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderPageImage" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderBodyLeftBorder" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderNavSpacer" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderTitleLeftBorder" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderTitleAreaSeparator" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderMiniConsole" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderCalendarNavigator" runat ="server" />
<asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat ="server"/>
<asp:ContentPlaceHolder id="PlaceHolderPageDescription" runat ="server"/>
<asp:ContentPlaceHolder id="PlaceHolderBodyAreaClass" runat ="server"/>
<asp:ContentPlaceHolder id="PlaceHolderTitleAreaClass" runat ="server"/>
<asp:ContentPlaceHolder id="PlaceHolderBodyRightMargin" runat="server" />
<asp:ContentPlaceHolder ID="PlaceHolderTitleRightMargin" runat="server" />
</asp:Panel>
</form>
</body>
</html>

Thursday, November 20, 2008

Fix DocAve Granular Backup error

Got the error when using AvePoint DocAve v5 to granular backup the full moss sites as following description from the report log.
Feature 'a0e5a010-1329-49d4-9e09-f280cdbed37d' for list template '10102' is not installed in this farm. The operation could not be completed.
11/20/2008 15:11:13=Backup Statistic Before List(http://mysharepoint/Documents):14 MB data, 7(0) sites, 19(0) webs, 154(1) lists, 1801(0) items.

After searching the feature id from 12 hive\TEMPLATE\FEATURES, it belongs to IPFSWebFeatures. Check the corresponding list, it's documents which can't be deleted as a list.
Hence open command line, and input following command to install this feature.
stsadm -o installfeature -filename IPFSWebFeatures\feature.xml
iisreset -noforce


Then it works.

Tuesday, November 11, 2008

The trial period for this product has expired

After restart prod server. All other site collection features working fine except Office SharePoint Server Publishing Infrastructure .It show me web page message "The trial period for this product has expired."


The MOSS is working on a 6 boxes load balance environment. I tried to upgrade to Enterprise license, change the app pool's running account to local administrators group, also added into Distributed COM Users group. Still doesn't work.


Detailed message:Feature receiver assembly 'Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c', class 'Microsoft.SharePoint.Publishing.PublishingFeatureHandler', method 'FeatureActivated' for feature '22a9ef51-737b-4ff2-9346-694633fe4416' threw an exception: Microsoft.SharePoint.SPException: The trial period for this product has expired. at Microsoft.SharePoint.Publishing.CmsSecurityUtilities.EnsureEvaluationNotExpired() at Microsoft.SharePoint.Publishing.PublishingFeatureHandler.FeatureActivated(SPFeatureReceiverProperties receiverProperties) at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce) Feature Activation: Threw an exception, attempting to roll back. Feature 'Publishing' (ID: '22a9ef51-737b-4ff2-9346-694633fe4416'). Exception: Microsoft.SharePoint.SPException: The trial period for this product has expired. at Microsoft.SharePoint.Publishing.CmsSecurityUtilities.EnsureEvaluationNotExpired() at Microsoft.SharePoint.Publishing.PublishingFeatureHandler.FeatureActivated(SPFeatureReceiverProperties receiverProperties) at Microsoft.SharePoint.SPFeature.DoActivationCallout(Boolean fActivate, Boolean fForce) at Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, Boolean fForce)


Finally, fixed the error. The entire process here:

You will find this error from not enough rights to read registry from internet.

The IIS application pool running account need to read DCOM and registry table for getting the production information.

By checking local group administrators and Distributed COM Users, I found the running accounts there. And then checking DCOM rights by command "dcomcnfg.exe" , still looks fine. So exclude this possibility.

Now open "regedit" to checking registry table. Open \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\12.0

It show me several item's path has inexistent driver. This is right the reason.

After found back the missing drivers, it does work.

What a tricky error message.

Friday, October 31, 2008

BlackBerry browser's table redering bug and mending

If you open a web page and there's a table which have rowspan or colspan in it.
You will find it's always can't display properly in the last row. It will miss handle rowspan or colspan in last column. That's basically happens on testified BlackBerry 8830 and 8700. It's also believable for others which include simulator and real device.
Whatever you use .NET GridView, Repeater, Datalist or others, it would happen definitely.

There are 2 method to fix this bug.

1. Add a new same structure blank row in the end of the table. Here is an example
It actually add a new <tr></tr> in the end.

<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td valign="middle" rowspan="2">HW</td>
<td>HW</td>
<td>HW</td>
<td valign="middle" rowspan="2">HW</td>
</tr>
<tr>
<td>HW</td>
<td>HW</td>
</tr>
<tr>
<td valign="middle" rowspan="2">HW</td>
<td>HW</td>
<td>HW</td>
<td valign="middle" rowspan="2">HW</td>
</tr>
<tr>
<td>HW</td>
<td>HW</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>

2. Add a new same structure blank column in the end of the table. Here's an example.
It actually add a new <td></td> in each </tr>.

<table border="1" cellpadding="0" cellspacing="0">
<tr>
<td valign="middle" rowspan="2">HW</td>
<td>HW</td>
<td>HW</td>
<td valign="middle" rowspan="2">HW</td>
<td></td>
</tr>
<tr>
<td>HW</td>
<td>HW</td>
<td></td>
</tr>
<tr>
<td valign="middle" rowspan="2">HW</td>
<td>HW</td>
<td>HW</td>
<td valign="middle" rowspan="2">HW</td>
<td></td>
</tr>
<tr>
<td>HW</td>
<td>HW</td>
<td></td>
</tr>
</table>

Tuesday, October 28, 2008

A batch file with datatime attribute for backup Alternate Access Mappings

Here show you a batch script for backing up AAM

c:
cd\
cls
@echo Backup Alternate Access Mappings
@for /f "tokens=2" %%i in ('date /t') do
@set thedate=%%i
@set mm=%thedate:~0,2%
@set dd=%thedate:~3,2%
@set yyyy=%thedate:~6,4%
stsadm -o enumalternatedomains >>
E:\data\Backup\AAM\AlternateAccessMappings_%mm%%dd%%yyyy%.txt
@echo Done

Friday, October 24, 2008

A DateTime Picker control designed for smartphone browser.

Based on Visual Studio .Net 2008 (with C#), I wrote a datetime picker for smartphone web, especially for BlackBerry.

The first version is actually a DatePicker named BBDatePicker for BlackBerry. I use it on WebPart and show for BlackBerry browser.

I will share with whose commenter here.
Send email to me (teddyyu@live.com) if you want get one.

Thursday, October 23, 2008

How to join custom reference DLL file in when deploy WebPart by STSDEV

Three steps for refer custermized dll such as custom control.
  1. Refer the dll of custom project in.
  2. Sign a key assembly in the custom dll souce project.
  3. Drag the dll into windows assembly and deployment corresponding wss virual directory.

Tuesday, October 21, 2008

STSDEV Debugging for WebPart, Site Definition or workflow.

After deploy the app (webpart etc) into SharePoint site, you want to debug your app as below steps:

  1. Enable debug in project properties.

    Right click project and click properties, click [Build] in left panel.
    Select the method in Configuration which is the deploy method you just done.
    Click to select both "Define DEBUG constant" and "Define TRACE constant".
    Click right-bottom "Advanced.." button and change [Debug Info:] to "full".
    Click [OK] and save all.
  2. Set breakpoint in debug area of your program
  3. Run "iisapp" in command line to choose which SharePoint run time "w3wp.exe" you should pick up. You can pick it by your running sharepoint site name.
  4. Click menu [Debug] - [Attach to Process...], and click the picked "w3wp.exe" and click [Attach] button, go on click [Attach] button on pop up warning window.
  5. Back to the page which host your app (webpart) and refresh or redeploy.

You will see the debug yellow bar pausing on your code for now. You can now use same debugging method by F11/F10 of VS.

Error handle while try to remove SSP

"The snapshot directory does not exist or is not properly configured."

Occasionally, it happened when I tried to delete SSP in SharePoint farm for verify a disaster/recovery procedure. The SSP can not be deleted successfully and not any changes even delete more times.

I then searched from microsoft and internet but get nothing back. What's the snapshot directory ? The error description looks weird and unreachable by internet.

By checking 12 hive logs, get "Delete site operation cancelled by user. Check the log files for additional details. " Hence I tried to delete the SSP host web application manually first and then go on delete the SSP. It worked then.

Friday, October 17, 2008

Where to change PWA administrator account ?

When you do a PWA migration to another environment, you will find the PWA can't be access by account of new environment. Once you want to change it from SharePoint central administration, you will find the PWA owner place is gray which is not able to be changed.

Actually, the PWA account control is not belongs to SharePoint management, it is still within Project control area. I have ever tried to find the owner information from the SharePoint Project content db and Config db but failed, I also spend couple minutes to search it from those 4 Project DB (Draft, Achieve, Published and Reporting) but still can't. If you know where it is specific table to hold, please put comment to let me know. I would appreciate of you.

Here is the steps:
  1. You will have to open http://yoursite/PWA by the previous administrator account which was created by project server procedure. If you can see the [Site Action] in the page left upper corner, that means you have rights to handle.
  2. You want to click [Server Settings] in left quick launch panel, click [Manage Users] under Security panel. You will find the administrator account in new opened page and you may create a new user with assign administrators Security Group for maximum the user rights.

Now by sign in a different user, you will have all the rights to control new PWA site collection.

The usage of Microsoft IT Site Delete Capture Feature 1.1

When try to recover a sub-site by the method of the instruction of document which is "stsadm -o store". I received the error message "Your backup is from a different version of Windows Sharepoint Services and cannot be restored to a server running the current version." I almost gave it up.
I got back to test it again for draft my mutiple levels recovery precedure. It looks the microsoft existing solution just missing the part of site and site collection recovery which is what MS IT Site Delete Capture do.
There's just one difference on it, i.e. Site-collection and Sub-site.


  1. For Site-collection which was created by central administration. Use the command:
    "stsadm -o restore -url http://www.yoursite.com/sites/deletedsitecollectionname -filename deletedsitecollectionname"
  2. For Sub-site which was created by user site action. Use the command:
    "stsadm -o import -url http://www.yoursite.com/deletedsubsitename -filename deletedsubsitename

For PWA workspaces or other same level site, you want to use the same operation with sub-site.

For lower level such as document library, list and items, the 2 level recycle bin take over the recovery.

For higher level such as web application, farm. you probably need operate the sharepoint central administration with database tools together.

Monday, October 13, 2008

WSS Resources parsing

How to get the value from <%$Resources:wss, mobile_field_separator%> ?
You just need to open 12 hive\CONFIG\Resources\wss.resx to find the name "mobile_field_separator", likewise, if the Resources:wss is something else, just need to find the file name of that.

How to get ListTypeID from current created site and list library.

For customizing a BlackBerry smartphone site page, you probably need to set your RendingTemplate for your mobile web app hosting place, generally, I will put it in a list library such as document library or custom list. This way, you will need to find the specific ListTypeID to define your RendingTemplate ID name as "Mobile_ListTypeID_View_Contents".

Here is the quickest method to find it.
  1. If these TypeId were customized in this new site definition Onet.xml file, you will have to find it from Onet.xml file within %12 hive%\TEMPLATE\SITETEMPLATES\Site_Type\xml\
  2. Normally, you will find it from where you created it. You want to find this create.aspx first, such as http://sharepointsite/_layouts/create.aspx. You need back to this create page and move the mouse to each library or type and see the bottom status bar, there should be a link such "http://mysharepoint/_layouts/new.aspx?FeatureId={00bfea71-e717-4e80-aa17-d0c71b360101}&ListTemplate=101" . You got, the last number is what you just need. (101 in this case)

Hope these will helpful.
Please post comment to discuss if you have any question.

Friday, October 10, 2008

A standard datareader to object sample web service

In one of my BlackBerry application, the requirements need to use MDS studio with background Oracle database, To push a table based query result present in blackberry smartphone screen.

Considering the MDS studio doen't support XML based dataset parsing and serializing. I have to think about other solution.

The MDS mainstream developing model is that invoke web service to generate a WSDL reference interface and then by MDS Data definitions and Message inbound/outbound mechanism to generate application.

Here is an example to get Oracle table to push up an object based data structure for MDS refer to. I feels like this is best solutino currently.

Originally, LINQ plus Generic solution is a good solution. But currently the Oracle still doesn't support LINQ without third part middleware supportings. Hope Microsoft can push out an solution with LINQ using on Oracle.

using System;using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Data.OracleClient;
using System.Collections.Generic;

namespace HourlySalesByObject
{
///
/// Summary description for GetHourlySalesByStoreObject
/// [WebService(Namespace = "http://services/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class
GetHourlySalesByStoreObject : System.Web.Services.WebService
{
[WebMethod] public List GetHourlySalesByStore_Sunday(int store_num)
{
List hourlySales = new List();
using (OracleConnection conn = new OracleConnection("Data Source=RTKTEST;Persist Security Info=True;User ID=korgiej;Password=korgiej;Unicode=True"))
{
OracleCommand cmd = conn.CreateCommand();
try
{
conn.Open();
cmd.CommandText =
"select * from (select STORE, EOW_DATE, HOUR, SUNDAY_TRANSACTIONS,
SUNDAY_AV_DOLLARS, SUNDAY_TOTAL_DOLLARS from PAM_HOURLY_SALES where STORE =" + store_num + " order by EOW_DATE desc) where rownum <= 50";

cmd.CommandType = CommandType.Text;

OracleDataAdapter da = new OracleDataAdapter(cmd);

//DataSet ds = new DataSet();
//ds.Clear();
//da.Fill(ds);
//conn.Close();

using (OracleDataReader odr = cmd.ExecuteReader())
{
while
(odr.Read())
{
HourlySale hourlySale = new HourlySale();
hourlySale.store = odr["STORE"].ToString();
hourlySale.eow_date = Convert.ToDateTime(odr["EOW_DATE"]);
hourlySale.hour = Convert.ToInt16(odr["HOUR"]);
hourlySale.transactions = Convert.ToDecimal(odr["SUNDAY_TRANSACTIONS"]);
hourlySale.av_dollars = Convert.ToDecimal(odr["SUNDAY_AV_DOLLARS"]);
hourlySale.total_dollars = Convert.ToDecimal(odr["SUNDAY_TOTAL_DOLLARS"]);
hourlySales.Add(hourlySale);
}
//List hourlySales = new List();
//foreach (DataRow row in ds.Tables[0].Rows)
//{
//hourlySale.store = row["STORE"].ToString();
//hourlySale.eow_date = Convert.ToDateTime(row["EOW_DATE"]);
//hourlySale.hour = Convert.ToInt16(row["HOUR"]);
//hourlySale.transactions = Convert.ToDecimal(row["SUNDAY_TRANSACTIONS"].ToString());
//hourlySale.av_dollars = Convert.ToDecimal(row["SUNDAY_AV_DOLLARS"].ToString());
//hourlySale.total_dollars = Convert.ToDecimal(row["SUNDAY_TOTAL_DOLLARS"].ToString());
// }
}
}
catch (Exception e)
{ hourlySales = null; }
}
return hourlySales;
}
}

public class HourlySale
{
public
HourlySale() {}
public string store { get; set; }
public DateTime eow_date { get; set; }
public Int16 hour { get; set; }
public Decimal transactions { get; set; }
public Decimal av_dollars { get; set; }
public Decimal total_dollars { get; set; }
}
}

Tuesday, October 7, 2008

Error while compile MDS or JDE project after remove JDK and JRE

You will probably get following errors after remove the JAVA env.

"The rapc compiler failed to run." and "Error Generating Launcher COD"

That caused by the JAVA_HOME or Path which lead jave env to a different place after you removed JAVA. As long as you change this to a proper one, it will work.

The RIM Code Signing

Once you get everything done and try to launch your custom app into your blackberry handheld. You will find you need to pay $20 for a code signing. Or you will get the error "blackberry Error starting Module attempts to access a secure API."

That's really cheeky. Feels like a trap. I finially decide to give up BlackBerry JDE development platform and back to MDS.

That certainly will result in the restrict of developing of BlackBerry application.
People will stand off BB dev gradually. Don't know how the hell they think about it.

Thursday, October 2, 2008

Create a minimum master page site definition by STSDEV

Working on BlackBerry & SharePoint site buildings. It's indispensability to build a SharePoint smartphone site. Integrated this site with the existing mobile pages (12 hive\TEMPLATE\LAYOUTS\MOBILE) together. It can commercially provide valuable web applications. Here show you how to implement it.

  1. Refer the previous post named "Create Site Definition by STSDEV " to create a default site definition.
  2. Refer the previous post named "Creating and Deploying a Custom Master Page with STSDEV" to merge Heather base master page.
  3. Replace the master page by following content and keep the same name "SharePointersDemoCustom.master" then redeploy by VS 2008.


<%-- Identifies this page as a .master page written in Microsoft Visual C# and registers tag prefixes, namespaces, assemblies, and controls. --%>
<%@ Master language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="wssuc" TagName="Welcome" src="~/_controltemplates/Welcome.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="DesignModeConsole" src="~/_controltemplates/DesignModeConsole.ascx" %>
<%@ Register TagPrefix="PublishingVariations" TagName="VariationsLabelMenu" src="~/_controltemplates/VariationsLabelMenu.ascx" %>
<%@ Register Tagprefix="PublishingConsole" TagName="Console" src="~/_controltemplates/PublishingConsole.ascx" %>
<%@ Register TagPrefix="PublishingSiteAction" TagName="SiteActionMenu" src="~/_controltemplates/PublishingActionMenu.ascx" %>
<%-- Uses the Microsoft Office namespace and schema. --%>
<html>
<WebPartPages:SPWebPartManager runat="server"/>
<SharePoint:RobotsMetaTag runat="server"/>

<%-- The head section includes a content placeholder for the page title and links to CSS and ECMAScript (JScript, JavaScript) files that run on the server. --%>
<head runat="server">
<asp:ContentPlaceHolder runat="server" id="head">
<title>
<asp:ContentPlaceHolder id="PlaceHolderPageTitle" runat="server" />
</title>
</asp:ContentPlaceHolder>
<Sharepoint:CssLink runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderAdditionalPageHead" runat="server" />
</head>

<%-- When loading the body of the .master page, SharePoint Server 2007 also loads the SpBodyOnLoadWrapper class. This class handles .js calls for the master page. --%>
<body onload="javascript:_spBodyOnLoadWrapper();">
<%-- The SPWebPartManager manages all of the Web part controls, functionality, and events that occur on a Web page. --%>
<form runat="server" onsubmit="return _spFormOnSubmitWrapper();">
<wssuc:Welcome id="explitLogout" runat="server"/>
<PublishingSiteAction:SiteActionMenu runat="server"/>
<PublishingWebControls:AuthoringContainer id="authoringcontrols" runat="server">
<PublishingConsole:Console runat="server" />
</PublishingWebControls:AuthoringContainer>
<%-- The PlaceHolderMain content placeholder defines where to place the page content for all the content from the page layout. The page layout can overwrite any content placeholder from the master page. Example: The PlaceHolderLeftNavBar can overwrite the left navigation bar. --%>
<asp:ContentPlaceHolder id="PlaceHolderMain" runat="server" />
<asp:Panel visible="false" runat="server">
<%-- These ContentPlaceHolders ensure all default SharePoint Server pages render with this master page. If the system master page is set to any default master page, the only content placeholders required are those that are overridden by your page layouts. --%>
<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderPageImage" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderBodyLeftBorder" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderNavSpacer" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderTitleLeftBorder" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderTitleAreaSeparator" runat="server"/>
<asp:ContentPlaceHolder ID="PlaceHolderMiniConsole" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderCalendarNavigator" runat ="server" />
<asp:ContentPlaceHolder id="PlaceHolderLeftActions" runat ="server"/>
<asp:ContentPlaceHolder id="PlaceHolderPageDescription" runat ="server"/>
<asp:ContentPlaceHolder id="PlaceHolderBodyAreaClass" runat ="server"/>
<asp:ContentPlaceHolder id="PlaceHolderTitleAreaClass" runat ="server"/>
<asp:ContentPlaceHolder id="PlaceHolderBodyRightMargin" runat="server" />
</asp:Panel>
</form>
</body>
</html>

Creating and Deploying a Custom Master Page with STSDev (Refer to SharePointers)

(Continue from last one: Create Site Definition by STSDEV)

Step 1: Add the base master page to the project

If you haven't already done so, download and unzip the base master page from Heather Solomon's site.

  1. Right click on your 'RootFiles\TEMPLATE\SiteTemplates\YourSiteTemplateName' directory and choose 'Add Existing Item'
  2. Select the base master page from your file system and click 'Add'
  3. Rename the file 'SharePointersDemoCustom.master'.

Step 2: Editing the Default.aspx file

  1. Open the default.aspx file
  2. At the top of the page, change the 'Page' directives 'MasterPageFile' attribute to '~masterurl/custom.master' (note that this value can only be 'default.master' or 'custom.master' but you can name your file whatever you like because the onet.xml file's element contains the reference to the actual file)
  3. Save the file

Step 3: Editing the onet.xml file

  1. Open the onet.xml file
  2. In the <listtemplates> node add the following child node:


    <ListTemplate Name="mplib" DisplayName="$Resources:MasterPageGallery;"
    Description="$Resources:global_onet_mplib_desc;"
    SetupPath="global\lists\mplib" Type="116"
    BaseType="1" Path="GLOBAL" Hidden="TRUE"
    HiddenList="TRUE" NoCrawl="TRUE" Unique="TRUE"
    Catalog="TRUE" OnQuickLaunch="FALSE" SecurityBits="11"
    AllowDeletion="False" AllowEveryoneViewItems="TRUE"
    Image="/_layouts/images/itdl.gif" AlwaysIncludeContent="TRUE"
    DocumentTemplate="100" />

  3. Find the <configuration> node the 'ID' attribute of 0 (zero)
  4. Add the 'MasterUrl' attribute to the <configuration> node like so:

    <Configuration ID="0" Name="Blank" MasterUrl="_catalogs/masterpage/SharePointersDemoCustom.master">

  5. The <configuration> node you just modified should have a <modules> child element. Add the following <modules> tag as a child of this node

    <Module Name="CustomMasterPage" />


  6. Now go to the outer <Modules> tag that is a child of the main <Project> node and add the following child <Module> node

    <Module Name="CustomMasterPage" List="116" Url="_catalogs/masterpage" RootWebOnly="FALSE">
    <File Url="SharePointersDemoCustom.master" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" />
    </Module>



Step 4: Deploy the project

  1. Again, STSDEV makes this a breeze. If this is the first time you've deployed this solution change your build configuration to DebugDeploy and do a build, otherwise do a DebugRedeploy.
  2. Now create a new site based on your site definition and see if your masterpage is working correctly. (Note, it should look pretty ugly since we haven't modified the UI yet.

Step 5: Start tweaking that master page!

Here's a bunch of really good resources for customizing your master pages all in one place. Heather Solomon really is the expert when it comes to SharePoint branding:

Create Site Definition by STSDEV (Refer to SharePointers)

This is a refer for a record to deposit.

Part 1: Generate the STSDEV solution
  1. Open Visual Studio and run STSDEV (should be an option on your tools menu if you ran through the tutorials, see above link)
  2. Choose to create an empty solution with C# assembly
  3. Click 'Create the Solution'
  4. After you create the solution, you'll need to open it from the file system. STSDEV does not automatically open it for you in Visual Studio.

Part 2: Set up the project structure

Even the most basic site definition needs at least 3 files: a webtemp.xml file, an onet.xml file, and a default.aspx file. So let's create these files in the appropriate places.
  1. right click on the 'RootFiles' folder and add a new folder called 'TEMPLATE'
  2. Under the 'TEMPLATE' folder you created add a new folder called '1033'
  3. Under the '1033' folder you created create a new folder called 'XML'
  4. In the 'TEMPLATE/1033/XML' folder add a new XML file called 'webtemp.YourSiteName.xml', where your site name is what you want to call your site.
    Under the 'TEMPLATE' folder you created add a new folder called 'SiteTemplates'
    Under the 'SiteTemplates' folder create a folder called 'Your Site Name', with the name of the site you'd like to use.
  5. In the 'Your Site Name' folder, create a folder called 'xml'Following those steps should set up your directory structure.

Part 3: The webtemp*.xml file

According to the MSDN documentation: 'The WebTemp*.xml files contain the site definition configurations that are available on the Template Selection section of the New SharePoint Site page'. So the details of this file determine how your site definition information will show up on the 'Create New Site' page.
  1. Go to the WebTemp.xml documentation page and copy the xml code into your webtemp*.xml file.
  2. Delete all the <template> nodes except for the first one
  3. In the only remaining <template> node, delete all the <configuration> nodes except the first one
  4. Enter a name for the <template> node 'Name' attribute (ensure this is the same name as your directory name in the SiteTemplates folder)
  5. Enter an id for the <template> node 'ID' attribute (if you've never done this before, start with 11001, this is because certain ID ranges are reserved. You'll notice that most of the out of the box templates are in the 10000 range, so hopefully anything in the 11000 range will be ok).
  6. Give the <configuration> node ID attribute a value of '0' (zero)
  7. Give the <configuration> node Title attribute a title of your choosing.
  8. Give the <configuration> node Description attribute a description of your choosing.
  9. Give the <configuration> node DisplayCategory attribute a category of your choosing (choosing 'Development' is a good idea, this will be the name of the tab on the 'Create Site' page that your site definition appears under)

Part 4a: Copying the onet.xml and default.aspx pages.

Since I will only be talking about the minimum needed to get your simple site definition working,
after you complete this (or before) you might want to read up on the documentation for onet.xml

Because the onet.xml and default.aspx files are fairly long I won't post it here. What I do is use the version that is generated from VSeWSS. If you don't have this, download it because it is pretty useful, and generates solutions for you as well. I actually used this all the time before STSDEV came out and I decided that STSDEV generated what I considered to be cleaner and more well structured solutions. I have a template directory that contains most of the files that I use that I just copy into my solutions as I create them. I'll give the instructions on how to get the onet.xml and default.aspx file into your solution if you have VSeWSS v1.1 installed.
  1. Right click on your solution node for your STSDev Project and choose Add > New Project
  2. Choose 'Blank Site Definition' and create it
  3. In the project expand the 'Site Definition' folder and you'll see an onet.xml file, copy this to the 'TEMPLATE/SiteTemplates/Your Site Name/xml' folder in your STSDEV project
  4. In the same 'Site Definition' folder you found the onet.xml file in, you'll see a default.aspx file, copy this to the 'TEMPLATE/SiteTemplates/Your Site Name'.

Part 4b: Modifying the onet.xml fileThere are only a few changes you need to make to the onet.xml file.
  1. Set the <project>node's 'Title' attribute to whatever you like.
  2. Set the <project>node's 'Revision' attribute to '1'.
  3. Set the <configuration>node's (under <project>) 'ID' attribute to '0' (zero).

Part 5: Deploy your solution

This is where STSDEV really shines, you basically don't need to do anything to get your site deployed other than select the 'DebugDeploy' configuration and do a build. If you did everything correctly you should be able to test your deployment by going to your site collection's home page and choosing Site Settings > Create and create a new site using your template.

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.