
2008年4月7日
FROM:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1131769&SiteID=1
Since we're using WSS 3.0 and not MOSS 2007, we have to create and use ASP forms for any custom Workflow Task Edit pages instead of being able to use InfoPath forms (which would be nice...maybe some day we'll step up to MOSS). The custom Workflow Edit Pages are used for custom Task Content Types that we create so that our Workflow Tasks can have additional fields beyond the standard Workflow Task fields. Once you've collected the values for the Task fields from the user on the ASP Workflow Task Edit form, the typical procedure is to create a hashtable and fill the hashtable with key/value pairs that represent the names of your Task fields and their associated values, as such:
// This function is called when the user clicks the Save/Submit button
// on the Custom Task Edit ASP form
public void btnSubmit_Click(object sender, EventArgs e)
{
// Create a hashtable that will be used to update the values of task fields
Hashtable taskHash = new Hashtable();
// For each field, create two values in the hashtable. If the field name
// matches a field in the Task content type, the field name will not be
// searchable as a key within the ExtendedProperties hashtable. So
// create a second field that is a duplicate of the first but having a
// name that doesn't exactly match an existing field in the Task
// content type. That way it will be a searchable key within the
// ExtendedProperties hashtable.
taskHash["UserInputField"] = UserInputField.Text;
taskHash["UserInputField_ForHash"] = UserInputField.Text;
taskHash["Status"] = "Completed";
taskHash["Status_ForHash"] = "Completed";
// Alter the task using the vaues in the hashtable
SPWorkflowTask.AlterTask(taskListItem, taskHash, true);
// Redirect to the appropriate web page
SPUtility.Redirect(taskList.DefaultViewUrl, SPRedirectFlags.UseSource, HttpContext.Current);
}
When you make the SPWorkflowTask.AlterTask() call, the values in the hashtable are stored in the Task in the ExtendedProperties collection for the Task. That having been done, the onTaskChanged() event of your Workflow (if you have defined one for this task) will fire. If you want to access the just-changed values for this task, you will find them in the ExtendedProperties collection of the AfterProperties for the task:
private void onTaskChanged_Invoked(object sender, ExternalDataEventArgs e)
{
// The taskIsComplete boolean variable is used as the
// test for the while loop in our workflow that controls
// when we break out of the loop and move to the
// CompleteTask() step. When the value is set to
// "Complete" on the ASP form, the ASP form saves it
// in the Task and then we retrieve it here in the
// onTaskChanged() event
if (taskAfterProperties.ExtendedProperties["Status_ForHash"] == "Completed")
taskIsComplete = true;
else
taskIsComplete = false;
}
The thing to note (and the thing that caused us a lot of grief trying to figure out) is that you cannot access the field in the ExtendedProperties hashtable using the actual name of the field. This is because, for some reason, even though you store the field in the hashtable using the Name of the field as the key (e.g., "Status"), the ExtendedProperties collection actually uses the GUID of the field as the key and not the field name.
To show it visually, here are the actual contents of the hashtable from the code above (using Visual Studio debugger). The first column shows the key values for the hashtable, and the second column shows the corresponding values for each key:
ExtendedProperties Count = 10 System.Collections.Hashtable
[{53101f38-dd2e-458c-b245-0c236cc13d1a}] "DOMAIN\\swickham"
[{c15b34c3-ce7d-490a-b133-3f4de8801b76}] "Completed"
["Status_ForHash"] "Completed"
[{1c5518e2-1e99-49fe-bfc6-1a8de3ba16e2}] "ows_UserInputField_ForHash='yes' ows_Status_ForHash='Completed' "
[{f1e020bc-ba26-443f-bf2f-b68715017bbc}] "512"
[{8cbb9252-1035-4156-9c35-f54e9056c65a}] "<HTML>\n <HEAD>\n <STYLE>\nTABLE.mail\n{\n..."
[{1d22ea11-1e32-424e-89ab-9fedbadb6ce1}] 155
[{4c12d635-7607-4911-a54a-7c239acdfcc3}] "yes"
["UserInputField_ForHash"] "yes"
[{4d2444c2-0e97-476c-a2a3-e9e4a9c73009}] "2007-01-19T17:10:55Z"
Notice that both values got saved for each field, but in the case of the field name for "Status", the GUID for the Status field is saved as the key and not the string "Status" that we asked it to save. Therefore, you can't retrieve the value of the Status field using "Status" as the key to the hashtable. The only time the ExtendedProperties will actually use the values you store as Field Names for the key is when the Field Names you use do not match any actual field names in the Task Content Type. That's why we use the scheme in the first block of code where we save the value of the field twice...first using the actual Field Name and the second time using a modified version of the field name that is similar enough to recognize. Then whenever we want to access the Task Field values in situations where we can get at them directly through the Field Collection (vs. through the ExtendedProperties Collection), we can use code such as:
string taskStatus = taskListItem["Status"];
And whenever we want to access the Task Field values in situations where we can't get at them directly through the Field Collection and must use the ExtendedProperties Collection, we can use code such as:
string taskStatus = taskAfterProperties.ExtendedProperties["Status_ForHash"];
and both values will be the same.
Please let us know if we're missing a much better way of doing this!
Scott
posted @
2008-04-07 16:33 追萝驴 阅读(130) |
评论 (0) |
编辑

2008年4月1日
开始学习MOSS/WSS了。收集了一些电子书,特此记录。大部分都没有看,不过对我看过的或正在看的并且觉得有值得一看之处的书,提供了下载。
7 Development Projects with the 2007 Microsoft Office System and Windows SharePoint Services 2007
Microsoft SharePoint Building Office 2007 Solutions in C# 2005
Microsoft SharePoint Building Office 2007 Solutions in VB 2005
Microsoft SharePoint 2007 Development Unleashed
Inside Microsoft Windows Sharepoint Services 3.0
经典。
Pro Sharepoint 2007 Development Techniques
SharePoint 2007 and Office Development Expert Solutions
SharePoint 2007 User's Guide Learning Microsoft's Collaboration and Productivity Platform
Office SharePoint Server 2007 The Complete Reference [1] [2]
看了一大半的Inside WSS 3.0这本书后,觉得希望能看看一本简单浅显的,譬如说,能看到一本对MOSS/WSS Build-In的Webparts有系统介绍的书。找了半天,也许是我找得不够仔细,这竟然是我唯一找到的一本。
Essential SharePoint 2007
Beginning SharePoint 2007 Administration
看这本书,是源于一个疑问:Designer到底能做什么?换句话说,我们为什么需要Designer?在这本书里,发现了一些答案。空间有限,本书暂时无法提供下载。
Professional SharePoint 2007 Development
Microsoft Windows SharePoint Services 3.0 Step by Step
Microsoft SharePoint 2007 Unleashed
Beginning SharePoint 2007 Building Team Solutions with MOSS 2007
posted @
2008-04-01 00:47 追萝驴 阅读(303) |
评论 (0) |
编辑

2008年2月22日
Feb.22.2008
晴
春节归来,想研究一下Team Foundation Server。由于本本的硬盘太小,所以考虑再三,只能装在原先的虚机里,环境是SVR 2003, SQL Server 2005, MOSS 2007。于是企图打开MOSS的管理中心先看看,竟然报错:
Internet Explorer cannot display the webpage
Most likely causes:
You are not connected to the Internet.
The website is encountering problems.
There might be a typing error in the address.
......
经过一番尝试,发现症状是:
“http://localhost:xxxx/”会报错,而http://localhost:xxxx/default.aspx能访问。不仅管理中心如此,其他sharepoint网站都这样。而普通ASP.NET站点没问题。
尝试过修复MOSS,但毫无作用。最后仔细察看IIS,发现虽然SharePoint Central Administration v3(管理中心)属性中的Documents里面的Default content page包括了Default.aspx,但其下层的aspnet_client目录并没有钩选Default content page选项。于是打上钩,确定,回到IE,F5----还是没用!
这个时候,想到可以用Fiddler察看以下整个HTTP连接的过程,于是打开Fiddler。想到我用的是IE7,要让Fiddler识别需要在localhost后面多打个".",于是改变网址为:http://localhost.:xxxx/,回车......硬盘开始狂转,然后地址栏自动变成了http://机器名:xxxx/default.aspx ----- 成功了!
再尝试其他Sharepoint站点,也都成功。真不知道是什么原因...一个点会这么重要吗???
需要指出的是,其他Sharepoint站点的aspnet_client目录的Document依然没有钩选Default content page.另外,之后再也不需要这个"."也能正常访问。
posted @
2008-02-22 15:00 追萝驴 阅读(32) |
评论 (2) |
编辑

2007年12月28日
SQL2005删除用户的时候,产生“数据库主体在该数据库中拥有架构,无法删除”的解决办法
--执行如下SQL语句
ALTER AUTHORIZATION ON SCHEMA::db_owner TO dbo;
--然后手动删除就可以了。
posted @
2007-12-28 14:36 追萝驴 阅读(123) |
评论 (0) |
编辑

2006年9月25日
遗忘VSS管理员密码的解决方法
关键词: VSS 遗忘管理员密码
如果忘记了VSS管理员密码,打开vss数据库所在的文件夹,打开data目录,
找到um.dat文件,用hex编辑器打开编辑它,从offset 80的55 55 开始
将值改为如下文所述的样子,然后保存,这样um.dat文件就回到了初始状态,
然后打开vss admin,用admin用户登录,就不需要密码了。
0:80 55 55 bc 7f 41 64 6d 69 6e 00 00 00 00 00 00 00
0:90 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0:a0 00 00 00 00 90 6e 00 00 a8 01 00 00 00 00 00 00
posted @
2006-09-25 13:16 追萝驴 阅读(389) |
评论 (0) |
编辑
登陆Administration,选择用户,Tools-->Options-->General:
去掉Use network name for automatic user log in的勾。
posted @
2006-09-25 13:14 追萝驴 阅读(237) |
评论 (0) |
编辑