Qeb Archives: Cov kev pab cuam lub Web SharePoint

Yuav tau qhia kom meej rau cov neeg ua tus nrhiav tau li cas / Cov qhov uas siv cov SharePoint 2013 SO API

Kuv twb tias koj tsis mus ua hauj lwm nrog cov SharePoint 2013 Nrhiav API ntawm so li thawj zaug. Kuv xav mus nrhiav neeg, tsis tau muaj ntaub ntawv. Lub ntsiab kev kawm ntawm no yog tias koj thov qhia cov kev pab ntawm nws cov GUID (los yog tsawg kawg yog qhov no). Cov nram qab no jQuery snippet qhia li cas:

    loadExpertsAsync: muaj nuj nqi() {

        jQuery.support.cors = tseeb;

        $.ajax({
            url: qhov no.CreateFullApiUrl() +
                "?querytext = 'portals'&sourceid = 'b09a7990-05ea-4af9-81ef-edfab16c4e31'" +
                "&selectproperties ='LinkedInProfileUrl,GoogleCirclesProfileUrl,BALargeProfilePictureUrls,BAGridPictures,WorkEmail,Kev txawj ntse,AboutMe,Nyiam,JobTitle,PastProjects,PictureURL,PreferredName,TwitterHandle,LinkedInProfileUrl,PreferredName,GoogleCirclesProfileUrl'" +
                "&rowlimit = 99",
            txujci: "TXAIS",
            headers: { "Txais": "daim ntawv thov/json; odata = verbose" },
            cache: tsis tseeb,
            zoo: muaj nuj nqi (ntog) {

Hauv kuv tsev neeg, Kuv tab tom khiav API tiv thaiv SharePoint hauv internet. Tau lub GUID, Kuv raws li cov kauj ruam:

  1. Mus saib hauv qhov chaw SharePoint admin
  2. Xaiv "nrhiav" los ntawm lub sab laug tes navigation
  3. Xaiv "Hwj tshwm sim los"
  4. Xaiv "Cov neeg hauv zos tau"
  5. Saib qhov URL.

Kuv qhov URL ntsia ib yam dab tsi zoo li:

https://xyzzy-admin.sharepoint.com/_layouts/15/searchadmin/EditResultSource.aspx?level=tenant&sourceid=b09a7990%2D05ea%2D4af9%2D81ef%2Dedfab16c4e31&view=1

Lub sourceid parameter yog dab tsi ua haujlwm rau kuv.

(Kuv to taub hais tias cov sourceid tej zaum yeej yuav ib tug tsi tshaj plaws lawm nrog SP, but I’ll always check anyway 🙂 ).

</kawg>

undefinedSubscribe rau kuv blog.

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

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

Lists.asmx, GetList thiab "tus nqi tsis raug null”

Kuv sab hnub uas cov GetList() txoj kev ua lists.asmx cov qhov Web site yog hu ua tib zoo heev lawm los sis yog nws muab pov ib mysterious kos "Tus nqi tsis tau thov" (thiab cov piv txwv uas yog tias koj tau txais yav tas los tseem heev tshaj generic yuam kev hais, "Kos yam ' Microsoft.SharePoint.SoapServer.SoapServerException’ ces muab pov twb tseg.")  Yeej, Kuv pom tias koj muab tsis tau prefix txhua yam nyob rau hauv cov txujci GetList.  Cov nram qab no jQuery snippet illustrates tus taw tes:

image

Yog hais tias ua li, qhov kev pab cov qhov web teb nrog "Tus nqi tsis tau thov" as per qhov no fiddler-yog muab HTTP transcript:

<?xml version = "1.0 Tub ntxhais" encoding = "utf-8"?>
  <xab npum:Hnab ntawv
     xmlns:xab npum ="
http://schemas.xmlsoap.org/soap/envelope/"    
     xmlns:xsi = "
http://www.w3.org/ 2001/XMLSchema-lom
     xmlns:xsd ="
http://www.w3.org/ 2001/XMLSchema">

  <xab npum:Lub cev>
    <xab npum:Txhaum>
      <faultcode>xab npum:Neeg rau zaub mov</faultcode>
      <faultstring>
        Kos yam ' Microsoft.SharePoint.SoapServer.SoapServerException’ ntawd ces muab pov tseg.
      </faultstring>
      <nthuav dav>
        <errorstring xmlns ="
http://schemas.Microsoft.com/sharepoint/soap/">
Tus nqi tsis tau thov.
        </errorstring>
      </nthuav dav>
    </xab npum:Txhaum>
  </xab npum:Lub cev>
</xab npum:Hnab ntawv>

tau mas, koj ntshe tsis ntxiv ntawd cov prefix "s0" ntawm tus kheej, tiam sis yog nws ua ib co cuab yeej (zoo li cov dab noj hnub).

Qhov no yog tag yim ruam tag / frustrating vim hais tias muaj lwm txoj kev tso ua kawg.  Piv txwv, lub GetListCollection txoj kev tsis mloog yog hais tias nws yog raug prefixed, Txawm tias yog muaj dev paus ua kawg xws li "xyzzy":

image

Qhov no "tus nqi tsis tau thov" rau nkawd MBDD ntau nrog lists.asmx hopefully li no yuav pab lwm tus neeg paub yav.

</kawg>

Subscribe rau kuv blog.

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