Domanda

Ho la raccolta del sito di SharePoint 'http://microsoft.com/' con poche nastri per bambini EX: http://microsoft.com/news/

Voglio creare il campo di ricerca all'elenco 'Pages'.Su ogni campo di ricerca Web Bambino dovrebbe puntare alla lista dei "pagine" di Web corrente.

Attualmente tutti i miei campi creati sono correlati a "pagine" lib sul sito radice.

Ho ricevuto la definizione del campo:

<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"/>
.

Questo campo aggiunto al mio tipo di contenuto utilizzato nelle pagine 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>
.

Ho provato ad aggiungere la definizione del campo a funzionalità con il sito "sito" e "web". Entrambi hanno gli stessi risultati.Ho solo una colonna di ricerca che punta al sito root.

Come rendere correlato questo campo Web?

È stato utile?

Soluzione

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

Altri suggerimenti

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/

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top