EricWang

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  6 随笔 :: 0 文章 :: 7 评论 :: 0 引用

2008年10月30日 #

不少人做MOSS RMS集成的时候会出这样那样的问题

本日志就把我本人遇到过的问题及解决方法写上吧

首先最多的可能是在管理中心设置IRM的时候出

1.所需的 Windows Rights Management Client 存在,但服务器已拒绝访问。在服务器授予权限之前,IRM 将不会运行。 XXXX  mname$domain.com XXXX这样的错误

这个错误是由于的权限设置问题,要在AD里头把MOSS管理员(还有MOSS站点应用程序池的运行帐户)加到 RMS 服务组里,然后把RMS服务组加到_wmcs\certification\ServerCertification.asmx上

 

2.在对文档进行发送到下载副本操作时出错:异常来自 HRESULT:0x80041056。且直接在线打开文档时WORD一片空白(应该说是一片空蓝)

这个错误是由于当前登陆MOSS的用户没有正确的MAIL属性,也有可能是AD里头没有设置MAIL属性的时候用户已经被导入到SSP里,后来AD里头已经设置了,但是还没有同步到SSP里。

3.下载文档时半天弹不出下载框,直接打开时WORD也是显示个下载的进度条。

这是由于MOSS访问不了RMS服务器。检查一下吧。。。。

4.在线打开文档WORD一片空白

这个错误是群里一个朋友遇到的,后来也解决了并共享了出来,原因是由于IIS池用的是本地帐户,无法和RMS进行交互导致。

 

能想起来的也就这么些。以后再想起来了或者再遇到了,再更新。如果有朋友遇到了别的问题,也欢迎回复出来^_^

posted @ 2008-10-30 09:15 EricWang 阅读(148) | 评论 (2)编辑

2008年10月28日 #

MOSS设置了内容部署。

WINDOWS事件日志里每天都有大量的这个错误。

 

GOOGLE了一下,发现原来是.NET FRAMEWORK 2.0的一个BUG,早就有了HotFix

去下载个KB923028打上就OK~

 

 

不好意思网络不行,导致发了三次

posted @ 2008-10-28 09:19 EricWang 阅读(173) | 评论 (2)编辑

2008年8月21日 #

 不废话,看配置节。。。

<SharePoint>
<SafeMode MaxControls = "200" CallStack = "false" DirectFileDependencies ="10" TotalFileDependencies = "50" AllowPageLevelTrace = "false">
<PageParserPaths>
<PageParserPath VirtualPath="/_catalogs/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true"/>
</PageParserPaths>
</SafeMode>
</SharePoint>
<SafeControl Src="/_catalogs/*" IncludeSubFolders="True" Safe="True" AllowRemoteDesigner="True" />
 
当然还有CustomError也要Off啦..
callstack设置为TRUE之后MOSS页面上的错误会显示出详细信息,在开发阶段很受用,实际部署的时候记得改回去
下面的 pageparserpaths 里可以设置MOSS允许哪个路径下的文件允许后台代码,可以直接指定到具体文件,明白人一看就知道怎么设置
这样在我们做母板页跟页面布局的时候比较爽。
至于怎么爽,需要的人才知道。嘿嘿
posted @ 2008-08-21 21:25 EricWang 阅读(316) | 评论 (0)编辑

2008年7月9日 #

 

1.
View只是存储下来的sql 语句
Views are nothing but saved SQL statements, and are sometimes referred as “Virtual Tables”.
Keep in mind that Views cannot store data (except for Indexed Views); rather they only refer to data present in tables.

2.
create a view

USE Northwind // 使用Northwind这个数据库

GO

CREATE VIEW vwSample

As

SELECT CustomerID, CompanyName, ContactName FROM CUSTOMERS

GO


use a view

SELECT * from vwSample


drop a view

DROP VIEW vwSample


3.

Creating Views with the SCHEMABIND Option

使用了这个选项之后,view里面引用到的表的shema就不能被改变了。

Creating a view with the SCHEMABINDING option locks the tables being referred by the view and prevents any changes that may change the table schema.

Notice two important points while creating a view with SCHEMABINDING OPTION:

  • The objects should be referred to by their owner names [two part name].
     
  • SELECT * is not permitted.

Here’s an example for a view with the SCHEMABIND OPTION:

CREATE VIEW vwSample

With SCHEMABINDING

As

SELECT

          CustomerID,

          CompanyName,

          ContactName

FROM DBO.CUSTOMERS -- Two part name [ownername.objectname]

GO


4.

Creating Views with the ENCRYPTION Option (一般情况下不要使用这个选项)

This option encrypts the definition of the view. Users will not be able to see the definition of the View after it is created.

USE NORTHWIND

GO

CREATE VIEW vwSample

With ENCRYPTION

As

SELECT

          CustomerID,

          CompanyName,

          ContactName

FROM DBO.CUSTOMERS

GO

SELECT *

FROM SYSCOMMENTS

WHERE ID FROM SYSOBJECTS WHERE XTYPE = ‘V’ AND

The view definition will be stored in an encrypted format in the system table named ‘syscomments’.


5.

Indexed Views

给一个view创建index

SQL SERVER 2000 allows an index to be created on a View. Wow! Previous versions of SQL SERVER will not allow you to do this. But one important point to be noted here is that the first index on the View should be a UNIQUE CLUSTERED INDEX only. SQL SERVER 2000 will not allow you to create any other INDEX unless you have an UNIQUE CLUSTERED INDEX defined on the view.

Let’s check out a sample example for an Indexed View:

CREATE VIEW vwSample

As

SELECT

          CustomerID,

          CompanyName,

          ContactName

FROM DBO.CUSTOMERS

GO

CREATE UNIQUE CLUSTERED INDEX indClustered

ON NORTHWIND.DBO.VWSAMPLE (CUSTOMERID)

GO

The above statement will create a unique clustered index on the View.


6.
Almost any SQL that can be issued natively can be coded into a view; there are exceptions, however. For example, the UNION operator can not be used in a view and you cannot create a trigger on a view.
view里不能进行union操作

7.
The text of any view can be retrieved from the SQL Server system catalog using the system procedure sp_helptext (unless the view was created specifying WITH ENCRYPTION). For example, this statement:
  使用命令来查看view的定义(也可以用这个命令来查看stored procedure的定义)
sp_helptext Sample_view
 
Might return the following output:
 
Text
CREATE VIEW Sample_View
AS SELECT title, au_fname, au_lname
FROM titles, titleauthor, authors
WHERE titles.title_id=titleauthor.title_id
AND authors.author_id=titleauthor.author_id

 
It is also possible to rename a view using the system procedure sp_rename.


8. 应该在确定要用的时候才去创建一个view。
Views should be created only when they achieve a specific, reasonable goal. Each view should have a specific application or business requirement that it fulfills before it is created. That requirement should be documented somewhere, preferably in a data dictionary or repository.
 There are seven primary uses for which views excel. These are:

   1. Security: to provide row and column level security
              note: view里可以调用USER_NAME()来获得当前登录用户的信息,从而每个登录的用户都回看到不同的view
   2. Efficient Access: to ensure efficient access paths
                 The use of proper join criteria and predicates on indexed columns can be coded into the view.
                 创建view的时候要特别留意sql语句的效率。
   3. Complexity: to mask complexity from the user
   4. Derived Data: to ensure proper data derivation
            view里面可以包含计算出来的column,方便使用。
   5. Domain Support: to provide domain support
          A domain basically identifies the valid range of values that a column can contain.
Some of the functionality of domains can be implemented using views and the WITH CHECK OPTION clause.
   6. Column Renaming:  to rename columns, and
   7. Single Solution View: to provide solutions which can not be accomplished without views
The final view usage situation might actually be the most practical usage for views—when views are the only solution!

9.
do not needlessly create SQL Server objects that are not necessary.
使用view的代价
In terms of views, for every unnecessary view that is created SQL Server will insert rows into the following system catalog tables: syscolumns, syscomments, sysdepends, sysobjects, sysprocedures, and sysprotects. If uncontrolled view creation is permitted, disk usage will increase, I/O problems can occur, and inefficient catalog organization may result.

10. View Naming convention
" Therefore, it stands to reason that views should utilize the same naming conventions as are used for tables."
但是对于后台开发人员,对view的命名里加入标识,可能会有好处。

11.
Always Specify Column Names
When creating views SQL Server provides the option of specifying new column names for the view or defaulting to the same column names as the underlying base table(s). It is always advisable to explicitly specify view column names instead of allowing them to default,


Reference
介绍view的基本语法
http://www.sql-server-performance.com/nn_views.asp

(好文章,推荐!)使用view的指导原则(什么时候应该使用view,一些经验,命名等7)
Using Views in Microsoft SQL Server, By Craig S. Mullins
http://www.craigsmullins.com/cnr_0299b.htm
posted @ 2008-07-09 11:11 EricWang 阅读(181) | 评论 (0)编辑

2008年5月8日 #

前天要做个让SPD在设计工作流的时候能添加的Activity .

场景是这样的,当流程走到某一步的时候,必须设置当前列表项的权限为部分人只读,部分人可修改,完了再走几步后恢复权限(先前没自定义权限,所以直接恢复继承就OK).

最后做完的效果应该是这样,SPD里设计工作流时可以在操作里找到我们自定义的Activity.


下面两张图是我们的
Activity被加到工作流里的界面.




 

那么,是怎么做到跟SPD集成的呢?其实很简单.

第一步,首先我们得先做好这个Activity.

建项目添加Activity之后.要添加两个引用




 

然后一堆的namespace.

然后一堆的DependencyProperty.

然后一堆的功能代码.

Activity的实现代码就不贴了,严重影响页面.^_^最下面有下载整个项目的连接
第二步,强签名程序集,因为我们要把它装到GAC.

签名过后Rebuild.DLL拖到GAC里去.

第三步,修改站点对应的目录里的web.config文件,搜索到</authorizedTypes>在这行上面加入一行:

 

<authorizedType Assembly="ItemRole, Version=1.0.0.0, Culture=neutral, PublicKeyToken=810fc8cb8b152837" Namespace="ItemRole" TypeName="*" Authorized="True" />

 

Assembly的值可以用Reflector来看程序集
 

第四步, 在服务器上注册我们的Activity

定位到路径C:\Program Files\Common Files\Microsoft Sharedweb server extensions\12\TEMPLATE\2052\Workflow

里面有个wss.actions,可以通过修改这个文件来注册我们的Activity

更推荐的做法是,参考wss.actions新建一个action后缀的文件 custom.actions

也可以直接修改wss.actions actions 节里加上下面两段:

<Action Name="设置列表项的权限"
      ClassName
="ItemRole.SetRoleActivity"
      Assembly
="ItemRole, Version=1.0.0.0, Culture=neutral, PublicKeyToken=810fc8cb8b152837"
      AppliesTo
="all"
      Category
="Sample">
      
<RuleDesigner Sentence="将%1的权限设置为%2用户只读,%3可写">         
    
<FieldBind Field="ListId,ListItem" Text="此列表" Id="1" DesignerType="ChooseListItem" />
    
<FieldBind Field="Reader" DesignerType="Person" Text="只读用户" Id="2"/>
    
<FieldBind Field="Editor" DesignerType="Person" Text="可写用户" Id="3"/>
    
</RuleDesigner>
    
<Parameters>
    
<Parameter Name="__Context" Type="Microsoft.SharePoint.WorkflowActions.WorkflowContext" Direction="In" />
    
<Parameter Name="ListId" Type="System.String, mscorlib" Direction="In" />
    
<Parameter Name="ListItem" Type="System.Int32, mscorlib" Direction="In"  />
    
<Parameter Name="Reader" Type="System.Collections.ArrayList, mscorlib" Direction="In" />
    
<Parameter Name="Editor" Type="System.Collections.ArrayList, mscorlib" Direction="In" />
      
</Parameters>
    
</Action>

    
<Action Name="恢复列表项的权限继承"
      ClassName
="ItemRole.ResetRoleInheritanceActivity"
      Assembly
="ItemRole, Version=1.0.0.0, Culture=neutral, PublicKeyToken=810fc8cb8b152837"
      AppliesTo
="all"
      Category
="Sample">
      
<RuleDesigner Sentence="将%1 恢复为继承父权限">         
    
<FieldBind Field="ListId,ListItem" Text="此列表" Id="1" DesignerType="ChooseListItem" />
    
</RuleDesigner>
    
<Parameters>
    
<Parameter Name="__Context" Type="Microsoft.SharePoint.WorkflowActions.WorkflowContext" Direction="In" />
    
<Parameter Name="ListId" Type="System.String, mscorlib" Direction="In" />
    
<Parameter Name="ListItem" Type="System.Int32, mscorlib" Direction="In"  />
      
</Parameters>
    
</Action>

来解释一下上面的代码

Action 的Name很好理解,就是在SPD里显示的名字,
ClassName指定类名,
Assembly不用说了,
AppliesTo,应用的对象,all就是全部,还可以是list,doclib
Category,在SPD里显示时的分类名
RuleDesigner 定义了在SPD添加了Activity后显示的东西。
FieldBind里有两个重要的的属性,Field跟DesignerType
有好多个DesignerType可用,对应着不同的弹出框和不同的功能。比如这里用到的Person ChooseListItem分别是用来选择用户和列表项的。
至于别的DesignerType和功能,最好的查阅地方我觉得还是wss.actions,对应着SPD显示出来的效果和功能去wss.actions里查看用的哪个Type.都用到什么Field等等。
Parameters里的每一个parameter对应着RuleDesigner里的Field,里面的各个属性也不难理解。
其中有一个__Context很重要。传递工作流运行时的上下文用的。
//其实没什么可解释的,一看就明白的那种。

第五步
,重启IIS.OK

现在用SPD在站点上创建工作流的时候就可以用到我们自己定制的Activity.(Activity一样是可以调试的,附加到正确的w3wp里就可以了)



完整项目下载

posted @ 2008-05-08 11:34 EricWang 阅读(377) | 评论 (3)编辑

2008年4月18日 #


MOSS里提供了一个非常好用的在线文本编辑器。
通常是我们在列表里创建了一个rtf的文本栏后新建一个item时RTF的栏会用文本编辑器来录入。
但如果我们想在自己写的WEBPART里或放到_layouts目录下的aspx页里使用这个控件该怎么办呢?


其实很简单!
第一步  添加Microsoft.Sharepoint.Publishing.dll的引用,路径在12目录的ISAPI下。

第二步  在ASPX文件加指令,如下
<%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

第三步 引用必要的JS CSS文件
<link rel="stylesheet" type="text/css" href="/_layouts/2052/styles/HtmlEditorCustomStyles.css"/>
<link rel="stylesheet" type="text/css" href="/_layouts/2052/styles/HtmlEditorTableFormats.css"/>
<script type="text/javascript" language="javascript" src="/_layouts/2052/init.js"></script>
<script type="text/javascript" language="javascript" src="/_layouts/2052/core.js"></script>
<script type="text/javascript" language="javascript" src="/_layouts/2052/HtmlEditor.js"></script>

第四步 就可以使用控件了。
<PublishingWebControls:HtmlEditor ID="he1" Html="Eric Wang" runat="server" />


效果:

   

posted @ 2008-04-18 16:02 EricWang 阅读(282) | 评论 (0)编辑