Category Archives: SharePoint Web Zerbitzuak

Bilaketa esparrua gisa Pertsonak nola ezartzean / Edukiak Iturria erabiliz SharePoint 2013 REST 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: funtzioa() {

        jQuery.support.cors = Egia;

        $.ajax({
            url: honetan.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",
            metodoa: "GET",
            headers: { "Accept": "application/json; odata=verbose" },
            cache: faltsuak,
            success: funtzioa (ondorioz,) {

Nire kasuan, 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 🙂 ).

</amaiera>

undefinedNire blog Harpidetu.

Follow me on Twitter http://www.twitter.com/pagalvin

Lists.asmx, GetListItems eta karpetak

Ikerketa batzuk egiten ari nintzen norbaitek gaur list.asmx web zerbitzua SharePoint zati gisa emandako inguruan 2010 (eta lehenagokoak).  Gai zerrendako elementuak lortzeko erro karpeta hartan izan zen (azpi-karpetak izenak barne), baina ezin izan da azpi-karpetetako elementuak.  I did some looking around on the internets and it’s a surprisingly common question.  Oraindik, I couldn’t get a good answer to the simple question, “if I know the folder, how do I get the items in the folder?"  To be honest, I didn’t try all that hard since I’ve wanted to figure this one out on my own for a while Smile.

To set this up, I created a site named “Blogging Scenarios” and a custom list named “Custom List with Sub Folders”.  I then created folders named:

  • Year 2005
  • Year 2006
  • Year 2007

I added a few items to the folder “Year 2006”.  Hau da, zer itxura:

image

My friend isn’t writing C# code but rather using Java, so the SOAP envelope was what she really needed.  To get that, I wrote a bit of jQuery and then used fiddler to get the actual HTTP conversation.

Hemen garrantzitsua da jQuery (Kodea kopiatu dut behera nahi duzun / kopiatu itsatsi bada):

image

Dute lehen gakoa da, bai bat ere <queryOptions> eta <QueryOptions> nodoa.  Bigarren gakoa da hori <Karpeta> nodo URL bat zein bezero du sarbidea.

Ez dago beste modurik izan daiteke hori lortzeko, baina hau ongi niretzat denean jQuery erabiliz.

Hemen gainetik egiteko gutun-azala SOAP da:

<soapenv:Gutun-azal xmlns:soapenv =’http://schemas.xmlsoap.org / xaboi / gutunazal /’>                
  <soapenv:Body>
    <GetListItems xmlns =’
http://schemas.microsoft.com / SharePoint / xaboi /’>
      <Hosto erorkorreko>Azpi-karpetak zerrenda pertsonalizatua</Hosto erorkorreko>
      <viewFields>  
        <ViewFields>
          <FieldRef izena = 'Izenburua’ />
          <FieldRef izena = 'EncodedAbsUrl’ />
        </ViewFields>
      </viewFields>
      <queryOptions>
        <QueryOptions>
          <Karpeta>
http://demoserver1/Blogging Eszenatoki / zerrendak / karpetak Azpi / 2006 Urtea zerrenda pertsonalizatua</Karpeta>
        </QueryOptions>
      </queryOptions>
   
</GetListItems>
  </soapenv:Body>
</soapenv:Gutun-azal>

Adibide eta honen inguruan eztabaida handia eragin zuen, uste dut behar zela niri <QueryOptions> zehaztu eta karpeta baten izena.  Niretzat, Behar Itzulbira bai barrutik dut <queryOptions> baita zehaztu URL erabat kualifikatua <Karpeta> nodo.

Here’s the jQuery AJAX setup:

$(dokumentu).prest(funtzioa() {
       var soapEnv =
           "<soapenv:Gutun-azal xmlns:soapenv =’http://schemas.xmlsoap.org / xaboi / gutunazal /’> \
               <soapenv:Body> \
                    <GetListItems xmlns =’http://schemas.microsoft.com / SharePoint / xaboi /’> \
                       <Hosto erorkorreko>Azpi-karpetak zerrenda pertsonalizatua</Hosto erorkorreko> \
                       <viewFields> \
                           <ViewFields> \
                              <FieldRef izena = 'Izenburua’ /> \
                              <FieldRef izena = 'EncodedAbsUrl’ /> \
                          </ViewFields> \
                       </viewFields> \
                       <queryOptions> \
                         <QueryOptions> \
                           <Karpeta>http://demoserver1/Blogging Eszenatoki / zerrendak / karpetak Azpi / 2006 Urtea zerrenda pertsonalizatua</Karpeta> \
                         </QueryOptions> \
                       </queryOptions> \
                   </GetListItems> \
               </soapenv:Body> \
           </soapenv:Gutun-azal>";

</amaiera>

Nire blog Harpidetu.

Follow me on Twitter http://www.twitter.com/pagalvin

Lists.asmx, GetList eta "balioa ezin izango da null”

Gaur egun aurkitu nuen GetList dela() metodoa lists.asmx web zerbitzua deitu behar da kontu handiz edo joera da misteriotsu bat bota "Balio ezin da hutsik egon" salbuespen (Eta hori da suposatuz errore are okerragoa generic mezua iragan dezakezu, “Exception of type ‘Microsoft.SharePoint.SoapServer.SoapServerException’ izan zen bota. ")  Zehazki, Ezin duzula ematen GetList metodoaren aurrizkia inolako aurkitu dut.  Ondorengo mozkina jQuery puntua erakusten:

image

Egiten baduzu, web zerbitzua "Balio ezin da hutsik egon" honen arabera erantzuten FIDDLER-emandako HTTP espedientea:

<?xml version="1.0" encoding="utf-8"?>
  <xaboi:Gutun-azal
     xmlns:xaboi ="
http://schemas.xmlsoap.org / xaboi / gutunazal /"    
     xmlns:xsi = "
http://www.w3.org/2001/XMLSchema-instance"
     xmlns:xsd ="
http://www.w3.org/2001/XMLSchema">

  <xaboi:Body>
    <xaboi:Errua>
      <faultcode>xaboi:Zerbitzari</faultcode>
      <faultstring>
        Exception of type ‘Microsoft.SharePoint.SoapServer.SoapServerException’ bota zen.
      </faultstring>
      <Xehetasun>
        <Errore katea xmlns ="
http://schemas.microsoft.com / SharePoint / xaboi /">
Balioa ezin da hutsik egon.
        </errorstring>
      </Xehetasun>
    </xaboi:Errua>
  </xaboi:Body>
</xaboi:Gutun-azal>

Jakina, seguruenik ez duzu zure kabuz "S0" aurrizkia duten, Tresna baina joera batzuk ere egin (Eclipse bezalako).

Hau da, are nahasgarria / beste metodo jasaten aurrizkiak delako frustrating.  Esate baterako, duen GetListCollection metodoa ez du axola ari bada aurretik, are like "xyzzy" aurrizkiak zentzugabekeria batekin:

image

Hau "balioa ezin da hutsik egon" badirudi nahiko ohikoa lists.asmx, beraz, espero dugu hau norbaiti laguntzeko izango da etorkizunean.

</amaiera>

Nire blog Harpidetu.

Follow me on Twitter http://www.twitter.com/pagalvin