質問

私はSharePointサイトコレクション 'http://microsoft.com/'がいくつかの子web web ex: http://microsoft.com/news/

Lookupフィールドを「ページ」リストに作成します。各子Web Lookupフィールドに現在のWeb 'Pages'リストを指す必要があります。

現在、私の作成されたフィールドは、ルートサイトの 'Pages' libと関連しています。

フィールド定義を得た:

<Field Name="LookupToPages" 
   ID="{3B5B07A0-68DB-4BF6-AAAE-87B77CE430C6}"
         Type="LookupMulti"
         DisplayName="Related News"
         Group="Intranet.ContentTypes"
         Mult="TRUE"
         Overwrite="TRUE"
         SourceID="http://schemas.microsoft.com/sharepoint/v3"
         List="Pages"
         ShowField="Title"/>
.

このフィールドは、ページlibで使用されているコンテンツタイプに追加されました:

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <ContentType ID="0000"
                Name="News"
               Group="my froup"
               Description="Page layout for intranet news."
               Inherits="TRUE"
               Version="0">    
    <FieldRefs>
      <FieldRef ID="{3B5B07A0-68DB-4BF6-AAAE-87B77CE430C6}" Name="LookupToPages" />
    </FieldRefs>
  </ContentType>
</Elements>
.

スコープ 'site'と 'web'を使った機能にフィールド定義を追加しようとしました。 どちらも同じ結果を持っています。ルートサイトを指すルックアップ列があります。

このフィールドWeb関連の方法は?

役に立ちましたか?

解決

Evgeny,

If this is a lookup to the list it self (i.e. you want to select elements form the same list, like related news articles) you can set the list property to "self".

<Field Name="LookupToPages" ID="{3B5B07A0-68DB-4BF6-AAAE-87B77CE430C6}" Type="LookupMulti" DisplayName="Related News" Group="Intranet.ContentTypes" Mult="TRUE" Overwrite="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" List="Self" ShowField="Title"/>

see here for further information:

http://msdn.microsoft.com/en-us/library/aa979575.aspx

他のヒント

Evgeny,

I recommend you utilize an event receiver if you're provisioning the list or content type through a feature.

In short, what you need to do is to create the lookup column on the list, get a field link to the new column, and then add the field link to the content type attached to the list.

Something like this should do the trick, provided you have myList, myListCT and pageList objects already:

string fieldName = myList.Fields.AddLookup("Page Column Display Name", pageList.ID, true);
SPField field = myList.Fields.GetFieldByInternalName(fieldName);
SPFieldLink fieldLink = new SPFieldLink(invoiceField);
myListCT.FieldLinks.Add(invoiceFieldLink);
myListCT.Update();

.b

In SP2013, you can create a Lookup column. In the "Get Information From" field, choose Site Pages.

I recommend you to use JSOM because it can be used in O 365 easily too. You can Use the method: fieldCollection.addFieldAsXml(fieldSchema, true, SP.AddFieldOptions.addToDefaultContentType);

See for further information: http://josharepoint.com/2015/12/02/create-a-new-lookup-field-using-jsom-in-sharepoint-2013-office-365/

ライセンス: CC-BY-SA帰属
所属していません sharepoint.stackexchange
scroll top