jamii Archives: SharePoint Mtandao Huduma

Jinsi ya TAJA Watu kama Tafuta Wigo / Content Kupunguza kutumia SharePoint 2013 Mapumziko 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: kazi() {

        jQuery.support.cors = kweli;

        $.ajax({
            url: hii.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",
            njia: "GET",
            headers: { "Accept": "application/json; odata=verbose" },
            cache: uongo,
            success: kazi (kusababisha) {

Katika kesi yangu, 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, lakini mimi daima utasikia kuangalia anyway 🙂 ).

</mwisho>

undefinedKujiunga na blog yangu.

Kufuata yangu juu ya Twitter kwa http://www.twitter.com/pagalvin

Lists.asmx, GetListItems na Folders

Mimi nilikuwa kufanya baadhi ya utafiti kwa ajili ya mtu leo ​​karibu huduma list.asmx mtandao zinazotolewa kama sehemu ya SharePoint 2010 (na mapema).  Aliweza kupata vitu orodha katika folder mizizi (ikiwa ni pamoja na majina ya ndogo folders-), lakini hakuweza kupata vitu katika sub-folders.  Sikuweza baadhi kuangalia kote juu ya internets na ni swali kushangaza kawaida.  Hata hivyo, Sikuweza kupata jibu zuri kwa swali rahisi, "Kama najua folder, jinsi gani mimi kupata vitu katika folder?"  Kuwa waaminifu, Mimi si kujaribu ngumu kwamba wote tangu nimekuwa alitaka kufikiri hii moja nje peke yangu kwa muda Smile.

Kuweka hii up, Mimi umba tovuti aitwaye "Mabalozi Matukio ya" na orodha desturi aitwaye "Desturi Orodha Folders na Sub".  Mimi kisha kuundwa folders aitwaye:

  • Mwaka 2005
  • Mwaka 2006
  • Mwaka 2007

Mimi aliongeza vitu kadhaa na "Mwaka 2006" folder.  Hii ni nini inaonekana kama:

image

Rafiki yangu si kuandika C # kanuni lakini badala ya kutumia Java, hivyo bahasha sabuni ilikuwa nini yeye kweli inahitajika.  Kupata kwamba, Niliandika kidogo ya jQuery na kisha kutumika fiddler kupata halisi HTTP mazungumzo.

Hapa ni jQuery husika (Mimi kunakiliwa kanuni chini chini kama unataka nakala / kuweka):

image

Wao muhimu ya kwanza ni pamoja na wawili <queryOptions> na <QueryOptions> nodi.  muhimu ya pili ni kwamba <Folder> nodi ni URL ambayo mteja ana upatikanaji.

Kunaweza kuwa na njia nyingine ya kupata hii, lakini hii kazi vizuri kwa ajili yangu wakati wa kutumia jQuery.

Hapa ni bahasha sabuni kwa juu:

<soapenv:Bahasha xmlns:soapenv =’http://schemas.xmlsoap.org / sabuni / bahasha /’>                
  <soapenv:Mwili>
    <GetListItems xmlns =’
http://schemas.microsoft.com / SharePoint / sabuni /’>
      <Deciduous>Orodha ya desturi na Folders Sub</Deciduous>
      <viewFields>  
        <ViewFields>
          <FieldRef Jina = 'Kichwa’ />
          <FieldRef Jina = 'EncodedAbsUrl’ />
        </ViewFields>
      </viewFields>
      <queryOptions>
        <QueryOptions>
          <Folder>
http://demoserver1/Blogging Matukio / orodha / Orodha ya Desturi na Folders Sub / Mwaka 2006</Folder>
        </QueryOptions>
      </queryOptions>
   
</GetListItems>
  </soapenv:Mwili>
</soapenv:Bahasha>

mengi ya mifano na majadiliano kote hii imesababisha mimi kuamini kwamba kila nahitaji mara <QueryOptions> na kutaja jina folder.  Kwa ajili yangu, Nahitaji wote wrap ndani ya <queryOptions> vilevile kutaja URL kikamilifu waliohitimu kwa <Folder> nodi.

Hapa ni jQuery AJAX kuanzisha:

$(hati).tayari(kazi() {
       mara soapEnv =
           "<soapenv:Bahasha xmlns:soapenv =’http://schemas.xmlsoap.org / sabuni / bahasha /’> \
               <soapenv:Mwili> \
                    <GetListItems xmlns =’http://schemas.microsoft.com / SharePoint / sabuni /’> \
                       <Deciduous>Orodha ya desturi na Folders Sub</Deciduous> \
                       <viewFields> \
                           <ViewFields> \
                              <FieldRef Jina = 'Kichwa’ /> \
                              <FieldRef Jina = 'EncodedAbsUrl’ /> \
                          </ViewFields> \
                       </viewFields> \
                       <queryOptions> \
                         <QueryOptions> \
                           <Folder>http://demoserver1/Blogging Matukio / orodha / Orodha ya Desturi na Folders Sub / Mwaka 2006</Folder> \
                         </QueryOptions> \
                       </queryOptions> \
                   </GetListItems> \
               </soapenv:Mwili> \
           </soapenv:Bahasha>";

</mwisho>

Kujiunga na blog yangu.

Kufuata yangu juu ya Twitter kwa http://www.twitter.com/pagalvin

Lists.asmx, GetList na "Thamani hawezi kuwa null”

Niligundua kwamba leo GetList() method in lists.asmx web service has to be called very carefully or it’s prone to throw a mysterious “Value cannot be null” exception (na hiyo ni kuchukua unaweza kupata nyuma ujumbe mbaya zaidi generic kosa, “Exception of type ‘Microsoft.SharePoint.SoapServer.SoapServerException’ akatupwa. ")  Hasa, I found that you can’t provide any kind of prefix on the GetList method.  The following jQuery snippet illustrates the point:

image

If you do that, the web service responds with “Value cannot be null” as per this fiddler-provided HTTP transcript:

<?xml version="1.0" encoding="utf-8"?>
  <soap:Bahasha
     xmlns:soap="
http://schemas.xmlsoap.org / sabuni / bahasha /"    
     xmlns:xsi=”
http://www.w3.org/2001/XMLSchema-instance"
     xmlns:xsd="
http://www.w3.org/2001/XMLSchema">

  <soap:Mwili>
    <soap:Fault>
      <faultcode>soap:Server</faultcode>
      <faultstring>
        Exception of type ‘Microsoft.SharePoint.SoapServer.SoapServerException’ was thrown.
      </faultstring>
      <detail>
        <errorstring xmlns="
http://schemas.microsoft.com / SharePoint / sabuni /">
Value cannot be null.
        </errorstring>
      </detail>
    </soap:Fault>
  </soap:Mwili>
</soap:Bahasha>

Bila shaka, you probably wouldn’t add that “s0” prefix on your own, but some tools are prone to do it (like Eclipse).

This is all the more confusing / frustrating because other methods tolerate prefixes.  Kwa mfano, the GetListCollection Njia haina akili kama imekuwa ni prefixed, hata na viambishi awali nonsense kama "xyzzy":

image

Hii "thamani hawezi kuwa null" inaonekana haki ya kawaida na lists.asmx hivyo hopefully hii itasaidia mtu nje katika siku zijazo.

</mwisho>

Kujiunga na blog yangu.

Kufuata yangu juu ya Twitter kwa http://www.twitter.com/pagalvin