Lists.asmx, GetListItems thiab Folders

Kuv tau ua tej kev soj ntsuam rau ib tug neeg niaj hnub ncig lub list.asmx Web site pab muaj li ntawm SharePoint 2010 (thiab ua ntej lawm).  Nws tau txais cov ntawv teev khoom ntawm lub hauv paus sis (xws li lub npe ntawm sub-folders), tab sis, tsis tau txais cov khoom nyob rau hauv sub-folders.  Kuv puas tau ib co saib ib ncig ntawm lub internets, thiab nws yog ib qho kuj ceeb tias lo lus nug.  Tsis tau, Kuv tsis tau muab lus teb rau lo lus nug yooj yim zoo, "yog hais tias kuv paub lub ceev, cas kuv yuav tau txais cov khoom nyob rau hauv daim nplaub tshev?”  Yuav tsis ncaj ncees, Kuv ho tsis sim ib tag li vim kuv yeej xav kom daim duab no ib qho tawm ntawm kuv tus kheej ib pliag Luag nyav.

Teeb no, Kuv tsim ib qhov chaw uas hu ua "Blogging Scenarios" thiab cov kev cai sau npe hu ua "Kev cai sau nrog Sub Folders".  Kuv ces zoo folders muaj npe:

  • Xyoo 2005
  • Xyoo 2006
  • Xyoo 2007

Kuv tov ob peb yam khoom rau hauv daim nplaub tshev "xyoo 2006".  Qhov no yog qhov uas nws zoo li:

image

Tab sis kuv cov phooj ywg tsis yog sau ntawv C# code, theej siv Java, vim li ntawd hauv lub hnab ntawv uas tsis yog tshuaj ntxuav tes muaj li nws yeej tau.  Tau tias, Sau tau me ntsis txog cov jQuery thiab ces muab fiddler los mus sib tham HTTP txhua lub sij.

Nov yog yam hais txog cov jQuery (Tau kuv theej lub chaws los hauv qab no yog koj xav luam los muab tshuaj):

image

Lawv thawj qhov tseem ceeb yog kom muaj ob lub <queryOptions> thiab <QueryOptions> ntawm.  Tus yuam sij thib ob uas yog tus <Ceev> ntawm no ib URL uas tus neeg muaj ntaub.

Tej zaum yuav muaj lwm txoj kev kom tau no, tab sis qhov haujlwm zoo rau kuv thaum uas siv cov jQuery.

Nov yog lub hnab ntawv tshuaj ntxuav tes mus rau saum:

<soapenv:Hnab ntawv xmlns:soapenv =’http://schemas.xmlsoap.org/soap/envelope/’>                
  <soapenv:Lub cev>
    <GetListItems xmlns =’
http://schemas.Microsoft.com/sharepoint/soap/’>
      <listName>Kev cai sau nrog Sub Folders</listName>
      <viewFields>  
        <ViewFields>
          <FieldRef Name ='Title’ />
          <FieldRef Name ='EncodedAbsUrl’ />
        </ViewFields>
      </viewFields>
      <queryOptions>
        <QueryOptions>
          <Ceev>
http://demoserver1/Blogging Scenarios/npe/nchuav sau nrog Sub Folders los lub xyoo 2006</Ceev>
        </QueryOptions>
      </queryOptions>
   
</GetListItems>
  </soapenv:Lub cev>
</soapenv:Hnab ntawv>

Ntau cov lus piv ntxwv thiab kev sib sab laj nyob ib ncig ntawm no coj kuv ntseeg tias txhua yam kuv xav tau <QueryOptions> thiab hais kom meej nplaub tshev npe.  Rau kuv, Kuv xav kom neb ob leeg qhwv nws sab hauv <queryOptions> li zoo li qhia kom meej URL mas tsim nyog rau cov <Ceev> ntawm.

Ntawm no yog cov jQuery AJAX teeb:

$(daim ntawv).npaj txhij(muaj nuj nqi() {
       Var soapEnv =
           "<soapenv:Hnab ntawv xmlns:soapenv =’http://schemas.xmlsoap.org/soap/envelope/’> \
               <soapenv:Lub cev> \
                    <GetListItems xmlns =’http://schemas.Microsoft.com/sharepoint/soap/’> \
                       <listName>Kev cai sau nrog Sub Folders</listName> \
                       <viewFields> \
                           <ViewFields> \
                              <FieldRef Name ='Title’ /> \
                              <FieldRef Name ='EncodedAbsUrl’ /> \
                          </ViewFields> \
                       </viewFields> \
                       <queryOptions> \
                         <QueryOptions> \
                           <Ceev>http://demoserver1/Blogging Scenarios/npe/nchuav sau nrog Sub Folders los lub xyoo 2006</Ceev> \
                         </QueryOptions> \
                       </queryOptions> \
                   </GetListItems> \
               </soapenv:Lub cev> \
           </soapenv:Hnab ntawv>";

</kawg>

Subscribe rau kuv blog.

Raws li kuv nyob Twitter tom http://www.twitter.com/pagalvin

6 xav txog"Lists.asmx, GetListItems thiab Folders

  1. Danias

    nyob zoo

    Kuv sim mus tso saib cov ntaub ntawv nyob rau hauv ib hais nplaub tshev uas siv rau ib SPD 2010 DataSource GetListItems

    Thaum txuas mus rau kuv cov qhov web thiab ntaus cov guid rau lub tsev qiv ntawv hauv daim ntawv
    Kuv tau hloov cov QueryOptions thiab sau cov lus hauv qab no daim CAML
    Me nyuam raws li TrainingCompanyX.

    Xwb no tsis rov muaj ntsiab – tshem cov QueryOptions parameter rov tag nrho cov ntaub ntawv hauv cov tsev qiv ntawv hauv paus ntawv….

    Yog kuv nrhiav tau nyob dua ib co tsawm tsawv thiab saib parameter thiab xam ua tus saib guid.

    Teb
    1. Paul Galvin Ncej sau

      Qhov no nws yog ib tug laus laus ncej/saib tu siab heev rau koj yeej tsis replying. Kuv xav tias koj ntev lawm figured seb lawv xav li cas.

      Teb
  2. Doug

    Thanks ib Rev rau no ncej, Paul. Kuv twb tau tau sim mus haus GetListItems ntawm ColdFusion cfhttp, thiab tsis tau txais lub hnab ntawv txoj kev. Nws thiaj li tau tuaj hla no ncej, thiab koj cov piv txwv ua haujlwm flawlessly. Tsaug dua.

    Teb
  3. Doug

    BTW – koj puas paub txog ib qho chaw uas teev hnab tag nrho rau cov tshuaj ntxuav tes kom zoo ntawv? Lub rau khoom no GetList luam tawm nyob rau microsoft.com tsis phim koj nyob nraum no…

    Teb

sau ntawv cia

Koj email chaw nyob yuav tsis muab luam tawm. Search cim *