Domanda

Ho meno di 5000 articoli nella mia biblioteca.Voglio ottenere 530 articoli per IDS.Quindi sto usando la seguente query.

<Where>
  <In>
    <FieldRef Name="ID" />
    <Values>
       <Value Type="Number">1</Value>
       <Value Type="Number">2</Value>
       .
       .
       .
       <Value Type="Number">530</Value>
    </Values>
  </In>
</Where>
.

Se utilizzo questa query sull'elenco, quindi mentre si verifica la seguente eccezione SpliStitemCollection.

System.ArgumentException: Value does not fall within the expected range.
   at Microsoft.SharePoint.Library.SPRequestInternalClass.GetListItemDataWithCallback2(IListItemSqlClient pSqlClient, String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pPagingPrevCallback, ISPDataCallback pFilterLinkCallback, ISPDataCallback pSchemaCallback, ISPDataCallback pRowCountCallback, Boolean& pbMaximalView) 
   at Microsoft.SharePoint.Library.SPRequest.GetListItemDataWithCallback2(IListItemSqlClient pSqlClient, String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pPagingPrevCallback, ISPDataCallback pFilterLinkCallback, ISPDataCallback pSchemaCallback, ISPDataCallback pRowCountCallback, Boolean& pbMaximalView) 
   at Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData() 
   at Microsoft.SharePoint.SPListItemCollection.GetEnumerator() 
.

Se riunisco la query con valori dall'operatore inferiore a 500, quindi SpliStitemCollection non sta lanciando un'eccezione.

Caml in operatore ha un limite di avere meno di 500 elementi uguali?O c'è qualche altro approccio migliore.

È stato utile?

Soluzione

Sicuramente guarda così dalla tua storia, ma non c'è un workaround abbastanza facile per questo?

<Where>
  <Or>
      <In>
        <FieldRef Name="ID" />
        <Values>
           <Value Type="Number">1</Value>
           <Value Type="Number">2</Value>
           .
           .
           .
           <Value Type="Number">499</Value>
        </Values>
      </In>
      <In>
        <FieldRef Name="ID" />
        <Values>
           <Value Type="Number">500</Value>
           <Value Type="Number">501</Value>
           .
           .
           .
           <Value Type="Number">999</Value>
        </Values>
      </In>
   </Or>
</Where>
.

E così via, con più nidificazione se oltre 1000 e così via.

Altri suggerimenti

Non può commentare a causa di un basso rep che pubblichi come risposta, i puristi perdona.

Rompere un elemento di 500 in diversi nidificato o tag non funziona, alla mia disperazione.Il limite è di 500 elementi apparentemente.

Ho provato a rompere con un limite di 500 elementi, 400, 300, 200, 100, e la query SPServices non riuscita, restituzione: 500 Errore del server interno con il seguente Responsabile:

Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.
.

Cercando di aggiornare 500 elementi al massimo (con un singolo tag o la rottura con i lavori nidificati o per 400, 300, 200, 100 elementi).Quindi la query restituisce 200 successi.A mia conoscenza dovrebbe anche essere un limite di nidificato o tag.

Sto usando: SPServices 2014.01, JQuery 1.11, SharePoint 2013:

$().SPServices.SPUpdateMultipleListItems({
    listName: "some list display name",
    CAMLQuery: CAMLQuery,
    valuepairs: [["static name of the field", 1]],
    completefunc: function (xData) {
        if (xData.status !== 200) {
            console.log("failure");
        }
    }
});
.

Esempio di interrogazione 5 * 100 + 1 che non riesce dal momento che ci sono 501 elementi:

<Query>
  <Where>
    <Or>
      <In>
        <FieldRef Name='ID' LookupId='TRUE' />
        <Values>
          100 times <Value Type='Lookup'>2688</Value>
        </Values>
      </In>
      <Or>
        <In>
          <FieldRef Name='ID' LookupId='TRUE' />
          <Values>
            100 times value
          </Values>
        </In>
        <Or>
          <In>
            <FieldRef Name='ID' LookupId='TRUE' />
            <Values>
              100 times value
            </Values>
          </In>
          <Or>
            <In>
              <FieldRef Name='ID' LookupId='TRUE' />
              <Values>
                100 times value
              </Values>
            </In>
            <Or>
              <In>
                <FieldRef Name='ID' LookupId='TRUE' />
                <Values>
                  100 times value
                </Values>
              </In>
              <In>
                <FieldRef Name='ID' LookupId='TRUE' />
                <Values>
                  <Value Type='Lookup'>3089</Value>
                </Values>
              </In>
            </Or>
          </Or>
        </Or>
      </Or>
    </Or>
  </Where>
</Query>
.

Inoltre non può commentare, ma quello che ho fatto quando ho confrontato con questo tipo di situazione (sì, ho riscontrato questa limitazione), è quello di eseguire la query usando il min & max dell'ID

<Where>
    <And>
        <Geq><FieldRef Name='ID' /><Value Type='Counter'>x</Value></Geq>
        <Leq><FieldRef Name='ID' /><Value Type='Counter'>y</Value></Leq>
    </And>
</Where>
.

Allora, supponendo di avere gli ID che effettivamente desidero in qualche tipo di enumerazione, utilizzare Linq per ottenere gli elementi che desideri effettivamente dai risultati della query.

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