SPList list = web.Lists["Orders"];                    
SPQuery query = new SPQuery();
query.Joins = @"
  <Join Type=’LEFT’ ListAlias=’customers’>
    <Eq>
      <FieldRef Name=’CustomerName’ RefType=’Id’ />
      <FieldRef List=’customers’ Name=’ID’ />
    </Eq>
  </Join>

  <Join Type=’LEFT’ ListAlias=’customerCities’>
    <Eq>
      <FieldRef List=’customers’ Name=’CityName’ RefType=’Id’ />
      <FieldRef List=’customerCities’ Name=’ID’ />
    </Eq>
  </Join>
";
query.ProjectedFields = @"
  <Field
    Name=’CustomerCity’
    Type=’Lookup’
    List=’customerCities’
    ShowField=’Title’ />
";
query.ViewFields = @"
<FieldRef Name='CustomerCity'/>
";
query.Query = @"
  <Where>
    <Eq>
      <FieldRef Name='CustomerCity'/>
      <Value Type='Text'>London</Value>
    </Eq>
  </Where>
";
 
SPListItemCollection items = list.GetItems(query);




posted @ 2012-02-05 22:24 队长 阅读(3) 评论(0) 编辑
<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="21003D96-D88E-42ed-AF97-2C4C22BFA3CF"
     
Title="Test Web Application Feature"
     
Description="I should be activated by default."
     
Version="1.0.0.0"
     
Scope="WebApplication"
     
Hidden="false"
     
xmlns="http://schemas.microsoft.com/sharepoint/"
     
ActivateOnDefault="true"
     
AutoActivateInCentralAdmin="true"
     
AlwaysForceInstall="true">
</Feature>
ActivateOnDefault 
 Optional Boolean. TRUE if the Feature is activated by default during installation or when a Web application is created; FALSE if the Feature is not activated. This attribute equals TRUE by default. The ActivateOnDefault attribute does not apply to site collection (Site) or Web site (Web) scoped Features.
In general, Farm-scoped Features become activated during installation, and when a new Web application is created, all installed Web application-scoped Features in it become activated.

AutoActivateInCentralAdmin
Optional Boolean. TRUE if the Feature is activated by default in the Administrative Web site, site collection, or Web application. This attribute equals FALSE by default. The AutoActivateInCentralAdmin attribute does not apply to Farm-scoped Features.





posted @ 2012-01-13 10:05 队长 阅读(4) 评论(0) 编辑
1. 如何表达枚举类型?
[StringSplitOptions] $option = "None"
[StringSplitOptions] $option = "RemoveEmptyEntries"
 
2. 在bat中调用执行Powershell文件(相对路径)
powershell.exe -Command "& {.\Script1.ps1}"
 
3. 加入-NoExit参数执行ps1文件
PowerShell.exe -NoExit " & ' C:\Program Files\...\sharepoint.ps1 ' "
 
4. 通用参数-confirm -ErrorAction
-Confirm $false
-ErrorAction "SilentlyContinue"
 
5. 创建对象并传递参数
$date = New-Object -TypeName System.DateTime -ArgumentList @(1882,7,4,0,0,0)
 
6. 创建COM对象
$ie = New-Object -ComObject "InternetExplorer.Application"
 
参考资料




posted @ 2012-01-11 09:07 队长 阅读(5) 评论(0) 编辑
1. 用代码判断本身
if (IntPtr.Size == 4)
{
    // 32-bit
}
else if (IntPtr.Size == 8)
{
    // 64-bit
}
2. 用代码判断正在运行的其他进程
 
 
If you have a hex editor program, just open your file with it and shortly after the standard header intro stuff (like "This program cannot be run in DOS mode...") you will see either
 
"PE..L" (hex code: 504500004C) = 32 bit
or
"PE..d†" (hex code: 504500006486) = 64 bit
 
其实普通文本编辑器就行(比如notepad),打开之后搜索PE就会得到类似下面的结果
(64位)
(32位)
 




posted @ 2012-01-10 17:04 队长 阅读(12) 评论(0) 编辑
        WindowsIdentity  identity  = WindowsIdentity.GetCurrent();
        WindowsPrincipal principal = new WindowsPrincipal(identity);
        if (!principal.IsInRole(WindowsBuiltInRole.Administrator))
        {
            MessageBox.Show("You must run this application as administrator. Terminating.");
            Application.Exit();
        }




posted @ 2012-01-09 13:04 队长 阅读(6) 评论(0) 编辑
摘要: http://msdn.microsoft.com/en-us/library/ms460914(v=office.14).aspxhttp://claytonj.wordpress.com/2008/03/19/custom-webconfig-settings-in-sharepoint/I have come across two ways to modify the web.config ...阅读全文
posted @ 2012-01-06 11:45 队长 阅读(2) 评论(0) 编辑
摘要: 参考这个:http://support.microsoft.com/kb/2639184简言之,微软为了防止dos攻击,在2011年5~8月份不知道哪个patch中将WebPart的xsl转换时间限制为1秒之内,如果超时就不显示该WebPart而给出如下错误消息:"Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft Sha阅读全文
posted @ 2012-01-06 11:16 队长 阅读(88) 评论(0) 编辑
摘要: @part = 'select top 1 * from ntp.dbo.penholdwhere convert(varchar, request_date, 111) = ntp.dbo.fn_getpreweekday(''' + @ldate + ''')'sp_execute_sql('select @var = count(1) from openquery(linkserver, '...阅读全文
posted @ 2011-11-29 21:16 队长 阅读(8) 评论(0) 编辑
摘要: 转自blogspot地址(天朝不让访问):http://blog-sharepoint.blogspot.com/2010/02/sharepoint-workflow-errors-descriptions.htmlThe following table lists some of the common errors that can occur in a Workflow developed ...阅读全文
posted @ 2011-11-17 15:47 队长 阅读(25) 评论(0) 编辑
摘要: v4.master (default for 2010)minimal.master (for Office 2010 Web Applications andSharePoint Server 2010 Search Center)default.master (for 2007 upgrade)nightandday.master (Available in SharePoint Server...阅读全文
posted @ 2011-10-26 08:54 队长 阅读(7) 评论(0) 编辑