Arkivji tal-Kategorija: SharePoint Servizzi Web

Kif To Speċifika Nies bħala Search Ambitu / Kontenut Sors Bl-użu SharePoint 2013 SERĦAN API

I had reason to work with the SharePoint 2013 Search API via REST for the first time. I wanted to search for people, not documents. The key learning here is that you specify content sources via its GUID (or at least in this case). The following jQuery snippet shows how:

    loadExpertsAsync: funzjoni() {

        jQuery.support.cors = vera;

        $.ajax({
            url: dan.CreateFullApiUrl() +
                "?querytext='portals'&sourceid='b09a7990-05ea-4af9-81ef-edfab16c4e31'" +
                "&selectproperties='LinkedInProfileUrl,GoogleCirclesProfileUrl,BALargeProfilePictureUrls,BAGridPictures,WorkEmail,Skills,AboutMe,Interests,JobTitle,PastProjects,PictureURL,PreferredName,TwitterHandle,LinkedInProfileUrl,PreferredName,GoogleCirclesProfileUrl'" +
                "&rowlimit=99",
            metodu: "GET",
            headers: { "Accept": "application/json; odata=verbose" },
            cache: falza,
            success: funzjoni (result) {

Fil-każ tiegħi, I’m running the API against SharePoint online. To get the GUID, I followed these steps:

  1. Access the SharePoint admin center
  2. Select “search” from the left hand navigation
  3. Select “Manage Result Sources”
  4. Select “Local People Results”
  5. Look at the URL.

My URL looked something like:

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

The sourceid parameter is what worked for me.

(I understand that the sourceid may actually be a sort of permanent thing with SP, but I’ll always check anyway 🙂 ).

</aħħar>

undefinedAbbona għall-blog tiegħi.

Follow lili Twitter fi http://www.twitter.com/pagalvin

Lists.asmx, GetListItems u folders

I kienet tagħmel xi riċerka għal xi ħadd illum madwar id-servizz web list.asmx pprovduta bħala parti mill SharePoint 2010 (u qabel).  Hija kienet kapaċi tikseb l-oġġetti lista fil-folder għerq (inklużi l-ismijiet tas-sub-folders), iżda ma setgħux jiksbu oġġetti f'sub-folders.  I ma xi tfittex madwar fuq il-internets u huwa kwistjoni sorprendentement komuni.  Madankollu, I ma setgħux jiksbu risposta tajba għall-mistoqsija sempliċi, "Jekk Naf li l-folder, kif nista 'nikseb l-oġġetti fil-folder?"  Biex inkun onest, I ma tipprova kollu li diffiċli peress stajt riedu figura dan wieħed fuq tiegħi stess għal waqt Tbissem.

Biex jistabbilixxu dan up, I ħolqot sit jismu "Xenarji Blogging" u lista tad-dwana bl-isem "Lista Custom mal folders Sotto".  I imbagħad maħluqa folders msemmija:

  • Sena 2005
  • Sena 2006
  • Sena 2007

I miżjuda ftit punti għall-folder "Sena 2006".  Dan huwa dak li jidher qisu:

image

My friend ma jkunx miktub C # kodiċi iżda pjuttost jużaw Java, sabiex il-pakkett SAPUN kien dak li hi verament meħtieġ.  Biex tikseb li, I kiteb daqsxejn ta 'jQuery u mbagħad użata fiddler biex jiksbu l-konversazzjoni HTTP attwali.

Hawn il-jQuery rilevanti (I kkupjati-kodiċi stabbiliti hawn taħt jekk inti tixtieq li kopja / paste):

image

Huma l-ewwel importanti hu li jinkludu kemm <queryOptions> u <QueryOptions> node.  It-tieni muftieħ huwa li l- <Folder> node huwa URL li l-klijent ikollu aċċess.

Jista 'jkun hemm modi oħra biex tikseb dan, iżda dan ħadem tajjeb għalija meta jużaw jQuery.

Hawn hu l-pakkett SAPUN għal dan t'hawn fuq:

<soapenv:Xmlns Pakkett:soapenv =’http://schemas.xmlsoap.org / sapun / pakkett /’>                
  <soapenv:Korp>
    <Xmlns GetListItems =’
http://schemas.microsoft.com / Sharepoint / sapun /’>
      <Jwaqqgħu l-weraq>Lista Custom mal folders Sotto</Jwaqqgħu l-weraq>
      <viewFields>  
        <ViewFields>
          <FieldRef Isem = "Titolu’ />
          <FieldRef Isem = "EncodedAbsUrl’ />
        </ViewFields>
      </viewFields>
      <queryOptions>
        <QueryOptions>
          <Folder>
http://demoserver1/Blogging Xenarji / listi / Lista Custom mal folders Sotto / Sena 2006</Folder>
        </QueryOptions>
      </queryOptions>
   
</GetListItems>
  </soapenv:Korp>
</soapenv:Envelop>

A lott ta 'eżempji u diskussjoni madwar dan wasslitni biex jemmnu li kollha I bżonn kien <QueryOptions> u tispeċifika isem folder.  Għalija, I-ħtieġa li kemm wrap dan ġewwa <queryOptions> kif ukoll tispeċifika URL ikkwalifikat bis-sħiħ għall- <Folder> node.

Hawn il-setup Ajax jQuery:

$(dokument).lest(funzjoni() {
       kien soapEnv =
           "<soapenv:Xmlns Pakkett:soapenv =’http://schemas.xmlsoap.org / sapun / pakkett /’> \
               <soapenv:Korp> \
                    <Xmlns GetListItems =’http://schemas.microsoft.com / Sharepoint / sapun /’> \
                       <Jwaqqgħu l-weraq>Lista Custom mal folders Sotto</Jwaqqgħu l-weraq> \
                       <viewFields> \
                           <ViewFields> \
                              <FieldRef Isem = "Titolu’ /> \
                              <FieldRef Isem = "EncodedAbsUrl’ /> \
                          </ViewFields> \
                       </viewFields> \
                       <queryOptions> \
                         <QueryOptions> \
                           <Folder>http://demoserver1/Blogging Xenarji / listi / Lista Custom mal folders Sotto / Sena 2006</Folder> \
                         </QueryOptions> \
                       </queryOptions> \
                   </GetListItems> \
               </soapenv:Korp> \
           </soapenv:Envelop>";

</aħħar>

Abbona għall-blog tiegħi.

Follow lili Twitter fi http://www.twitter.com/pagalvin

Lists.asmx, GetList u "Valur ma tistax tkun nulla”

Skoprejt illum li l-GetList() metodu lists.asmx servizz web għandu jiġi msejjaħ b'reqqa jew huwa suxxettibbli li tarmi misterjuża "valur ma jistax jiġi null" eċċezzjoni (u thats jekk wieħed jassumi inti tista 'tikseb passat il-messaġġ ta' żball saħansitra agħar ġeneriku, “Exception of type ‘Microsoft.SharePoint.SoapServer.SoapServerException’ kien jintefa. ")  Speċifikament, I sabet li inti ma tistax tipprovdi xi tip ta 'prefiss fuq il-metodu GetList.  Il snippet jQuery li ġej juri l-punt:

image

Jekk inti tagħmel dan, is-servizz web jirrispondi "valur ma jistax jiġi null" bħala kull din fiddler-sakemm traskrizzjoni HTTP:

<?xml version="1.0" encoding="utf-8"?>
  <sapun:Envelop
     xmlns:sapun ="
http://schemas.xmlsoap.org / sapun / pakkett /"    
     xmlns:XSi = "
http://www.w3.org/2001/XMLSchema-instance"
     xmlns:xsd ="
http://www.w3.org/2001/XMLSchema">

  <sapun:Korp>
    <sapun:Tort>
      <faultcode>sapun:Server</faultcode>
      <faultstring>
        Exception of type ‘Microsoft.SharePoint.SoapServer.SoapServerException’ kien jintefa.
      </faultstring>
      <dettall>
        <xmlns spag żball ="
http://schemas.microsoft.com / Sharepoint / sapun /">
Valur ma jistax ikun null.
        </errorstring>
      </dettall>
    </sapun:Tort>
  </sapun:Korp>
</sapun:Envelop>

Of course, inti probabilment ma jżidx li "s0" prefiss fuq tiegħek, iżda xi għodda huma suxxettibbli li jagħmlu dan (bħal Eclipse).

Dan huwa aktar konfużjoni / frustranti minħabba metodi oħra jittolleraw prefissi.  Per eżempju, l- GetListCollection metodu ma mind jekk huwa kien prefissi, anke ma 'prefissi nonsense bħal "xyzzy":

image

Din il-"valur ma jistax ikun null" tidher pjuttost komuni ma lists.asmx hekk nisperaw li dan se jgħinu lil xi ħadd fil-futur.

</aħħar>

Abbona għall-blog tiegħi.

Follow lili Twitter fi http://www.twitter.com/pagalvin