Ufumbuzi: SPQuery Je Si Tafuta Folders

This past week I was implementing an "evolving" solution for a client that uses BDC and SPQuery and ran into some difficulty using SPQuery against a document library containing folders. Bottom line: assign "recursive" kwa sifa mtazamo wa swala.

Yangu mazingira:

  • Jumatatu, Mimi upload hati na ugavi baadhi ya data meta.
  • Wiki iliyofuata, I upload a new document. Much of this new document’s meta data is based on the document I uploaded on Monday (which we call the "master document").
  • Tumeunda huduma ya mtandao façade ambayo hutoa interface BDC-kirafiki na orodha hivyo kwamba watumiaji urahisi Machapisho kwamba hati Jumatatu kupitia tafuta cheo.
  • A BDC data column provides a friendly user interface. (Hii ni sehemu ya jaribio yangu katika kutumia BDC kwa safu zaidi ya kirafiki Lookup).

mwisho BDC façade huduma anatumia swala kama hii kufanya lookup:

 // Kutumika U2U chombo ili kusaidia katika kuzalisha hii hoja CAML.
      oQuery.Query =
        "<Ambapo>";

      kama (titleFilter.Length > 0)
        oQuery.Query   =
          "  <Na>";

      oQuery.Query   =
        "    <Na>" +
        "      <Geq>" +
        "        <FieldRef Name=\"DocumentId\" />" +
        "        <Value Type=\"Text\">" + MinID + "</Thamani>" +
        "      </Geq>" +
        "      <Leq>" +
        "        <FieldRef Name=\"DocumentId\" />" +
        "        <Value Type=\"Text\">" + maxId + "</Thamani>" +
        "      </Leq>" +
        "    </Na>";

      kama (titleFilter.Length > 0)
        oQuery.Query   =
          "    <Ina>" +
          "      <FieldRef Name=\"Title\" />" +
          "      <Value Type=\"Text\">" + titleFilter + "</Thamani>" +
          "    </Ina>" +
          "  </Na>";
      oQuery.Query   =
        "</Ambapo>";

Wakati wa hatua ya awali ya maendeleo, this worked great. Hata hivyo, sisi ilianzisha folders katika saraka ya kutatua baadhi ya matatizo na ghafla, my BDC picker wouldn’t return any results. I tracked this down to the fact that the SPQuery would never return any results. We used folders primarily to allow multiple files with the same name to be uploaded but with different meta data. When the file is uploaded, sisi kujenga folder msingi ID bidhaa orodha na kisha kuondoka faili huko (Niliandika kuhusu kwamba hapa; tulikuwa na mchanganyiko matokeo na mfumo huu lakini kwa ujumla, ni kazi vizuri). The user don’t care about folders and in fact, don’t really understand that there are any folders. We have configured all the views on the library to show items without regard to folders.

I hit this problem twice as the technical implementation evolved and solved it differently each time. The first time, I wasn’t using the CONTAINS operator in the query. Without a CONTAINS operator, I was able to solve the problem by specifying the view on the SPQuery’s contructor. Instead of using the default constructor:

SPList oList = web.Lists["Documents"];

SPQuery oQuery = mpya SPQuery();

Mimi badala kutumika kuujenga kwamba maalum mtazamo:

SPList oList = web.Lists["Documents"];

SPQuery oQuery = mpya SPQuery(oList.Views["All Documents"]);

Kwamba kutatuliwa tatizo na mimi kuanza kupata matokeo yangu.

I then added the CONTAINS operator into the mix and it broke again. It turns out that the CONTAINS operator, hivyo mbali kama naweza kuwaambia, haifanyi kazi kwa lengo njia ile ile kama GEQ rahisi / LEQ operators. I did some searching and learned that the query’s ViewAttributes should be set to "Recursive", kama katika:

oQuery.ViewAttributes = "Scope=\"Recursive\"";

That solved the problem for CONTAINS. Kwa kweli, hii pia kutatuliwa tafuta yangu ya awali tatizo na kama alikuwa maalum sifa kujirudia mara ya kwanza, Mimi bila kuwa na kukimbia katika suala tena.

ukweli kwamba SPQuery maoni makao kazi kwa waendeshaji baadhi (GEQ/LEQ) na si watu wengine (Ina), pamoja na ukweli kwamba KPIs hawaonekani kazi wakati wote na maktaba hati folder zenye inaongoza mimi kuamini kwamba SPQuery ina baadhi ya masuala orthogonality.

Shukrani maalum:

</mwisho>

Kujiunga na blog yangu!

3 mawazo juu ya "Ufumbuzi: SPQuery Je Si Tafuta Folders

  1. Hakuna jina

    http://www.batteryfast.co.uk/asus/w3v.htm ASUS w3v betri,
    http://www.batteryfast.co.uk/asus/w3000a.htm asus w3000a battery,
    http://www.batteryfast.co.uk/asus/w3000.htm ASUS w3000 betri,
    http://www.batteryfast.co.uk/asus/w3000v.htm ASUS w3000v betri,
    http://www.batteryfast.co.uk/asus/a31-s5.htm ASUS a31-S5 betri,
    http://www.batteryfast.co.uk/asus/a32-s5.htm ASUS a32-S5 betri,
    http://www.batteryfast.co.uk/asus/s52n.htm ASUS s52n betri,
    http://www.batteryfast.co.uk/asus/s5000.htm ASUS s5000 betri,
    http://www.batteryfast.co.uk/asus/s5200n.htm ASUS s5200n betri,
    http://www.batteryfast.co.uk/asus/s5n.htm ASUS s5n betri,
    http://www.batteryfast.co.uk/asus/90-naa1b1000.htm ASUS 90-naa1b1000 betri,
    http://www.batteryfast.co.uk/asus/s2691061.htm ASUS s2691061 betri,
    http://www.batteryfast.co.uk/asus/a42-v6.htm ASUS a42-v6 betri,
    http://www.batteryfast.co.uk/asus/a32-u5.htm ASUS a32-u5 betri,
    http://www.batteryfast.co.uk/asus/u5f.htm ASUS u5f betri,
    http://www.batteryfast.co.uk/asus/u5a.htm ASUS betri U5A,
    http://www.batteryfast.co.uk/asus/u5f.htm ASUS u5f betri,
    http://www.batteryfast.co.uk/asus/u5.htm ASUS U5 betri,
    http://www.batteryfast.co.uk/compaq/nw8000.htm Compaq nw8000 betri,
    http://www.batteryfast.co.uk/compaq/nc8000.htm Compaq nc8000 betri,
    http://www.batteryfast.co.uk/compaq/v1000.htm Compaq v1000 betri,
    http://www.batteryfast.co.uk/compaq/nc6000.htm Compaq nc6000 betri,
    http://www.batteryfast.co.uk/compaq/nx5000.htm Compaq nx5000 betri,
    http://www.batteryfast.co.uk/compaq/n600.htm Compaq n600 betri,
    http://www.batteryfast.co.uk/compaq/n600c.htm Compaq n600c betri,
    http://www.batteryfast.co.uk/compaq/n610c.htm Compaq n610c betri,
    http://www.batteryfast.co.uk/compaq/n610v.htm Compaq n610v betri,
    http://www.batteryfast.co.uk/compaq/n620c.htm Compaq n620c betri,
    http://www.batteryfast.co.uk/compaq/e500.htm Compaq E500 betri,
    http://www.batteryfast.co.uk/compaq/e500s.htm Compaq e500s betri,
    http://www.batteryfast.co.uk/compaq/v300.htm Compaq V300 betri,
    http://www.batteryfast.co.uk/compaq/v500.htm Compaq v500 betri,
    http://www.batteryfast.co.uk/compaq/pp2060.htm Compaq pp2060 betri,
    http://www.batteryfast.co.uk/compaq/nx9000.htm Compaq nx9000 betri,
    http://www.batteryfast.co.uk/compaq/nx9005.htm Compaq nx9005 betri,
    http://www.batteryfast.co.uk/compaq/nx9010.htm Compaq nx9010 betri,
    http://www.batteryfast.co.uk/compaq/nx9020.htm Compaq nx9020 betri,
    http://www.batteryfast.co.uk/compaq/n110.htm Compaq n110 betri,
    http://www.batteryfast.co.uk/compaq/n110s.htm Compaq n110s betri,
    http://www.batteryfast.co.uk/compaq/pp2101x.htm Compaq pp2101x betri,
    http://www.batteryfast.co.uk/compaq/presario-2100.htm Compaq presario 2100 betri,
    http://www.batteryfast.co.uk/compaq/ze4000.htm Compaq ze4000 betri,
    http://www.batteryfast.co.uk/compaq/f4809a.htm Compaq f4809a betri,
    http://www.batteryfast.co.uk/compaq/f4812a.htm Compaq f4812a betri,
    http://www.batteryfast.co.uk/dell/inspiron-700m.htm Dell Inspiron 700m betri,
    http://www.batteryfast.co.uk/dell/inspiron-710m.htm Dell Inspiron 710m betri,
    http://www.batteryfast.co.uk/dell/latitude-x200.htm dell latitude x200 betri,
    http://www.batteryfast.co.uk/dell/8u443.htm dell betri 8u443,
    http://www.batteryfast.co.uk/dell/312-0058.htm dell 312-0058 betri,

    Kujibu

Kuondoka Reply

Anwani yako si kuchapishwa. Mashamba required ni alama *