Hli Archives: Lub ob hlis ntuj 2014

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

Piv txwv li SharePoint so hu

Hauv qab no yog qauv so hu uas ua hauj lwm rau kuv thiab tej zaum yuav pab tau koj thiab txheej. Li ntawm 02/2014, yog piv txwv 2 🙂

  1. Reference ib sab nrog rau tej qhov chaw hauv nws lub npe
  2. Siv ib tug ncej tag ntau qho
  3. Ua ib tug neeg mus nrhiav ntawm so

 

Kuv mam ntxiv rau qhov no raws li lub sij hawm dhau mus.

Nov yog ib co pab inks kuv twb pom zoo li:

Reference ib sab nrog rau tej qhov chaw hauv nws lub npe

Kuv tsim ib daim ntawv teev kev cai nrog rau ib sab hu ua "Blog sau" (qhov chaw ntawm cov Blog thiab sau).

Yog tus $select mus reference ntawd qhia kiag:

image

Ib tsab no yuav hloov tau qhov chaw uas "_x0020_". Peb pom cov _x0020_ nyob rau cov qauv no nyob rau internets thiab so kom txaus yog tsis txawv.

Yog hais tias tsis txhob ua li, koj nyob nraum nyog yuav tau txais ib qho lus yuam kev li no:

Cov qhia “Blog sau” yog tsis siv tau.

Yooj yim txaus.

Siv ib qho ntau Lookup sab

Teeb:

  1. Tsim ib daim ntawv teev kev cai hu ua pawg.
  2. Ntxiv rau tej pawg. Kuv ntxiv tus kab thusly:image
  3. Tsim dua sau kev cai hu ua MockBlog thiab ntxiv cov pawg raws li ib qho ntau teev kem (los yog qhov chaw qhia kiag tias yog li cas koj ntog).

Ntxiv ib co khoom rau koj daim ntawv teev hauv Mockblog thiab koj.

Tus Ajax style hu siv jQuery yuav nrhiav tej yam zoo li no:

serverUrl  = "/_api/web/npe/GetByTitle('MockBlog')/khoom" +
             "?$xaiv = Title,Pawg/Title,Blog_x0020_Author/Title" + 
             "&$nthuav = Blog_x0020_Author,Pawg";

Peb nyob nraum qhia SharePoint "muab kuv lub npe rau txhua pawg (Pawg/Title). Tau qhov tseeb qhov tseem ceeb rau Npe by $nthuaving pawg daim ntawv." (Kuv RESTful paraphrasing yog xoob ntshe zoo nkauj, tab sis qhov no li cas kuv tabtom txhais tau tias).

Yog koj nyob nraum ua no ntawm JavaScript thiab siv cov Fiddler nyob hauv cov zis, koj mus muab tau tej yam zoo li no koom:

 

image

(Cov saum no yog ib yam twj paj nruas JSON)

Ua ib tug neeg mus nrhiav ntawm so

Kuv blogged txog no nyias. Lub ntsiab yog hais kom meej ib sourceid parameter cov nqi uas nws yog tus GUID uas yog lub zos neeg qha qhov. (Qha qhov chaw siv yog hu ua scopes thiab yog kuv-huag-kuv nyuaj ua luaj tsis txhob hu rau txhua tsav txhua tus uas duav txhua yam rau kuv!).

Read ntxiv hais txog nws ntawm no: http://www.mstechblogs.com/paul/?p=10385

 

</kawg>

undefinedSubscribe rau kuv blog.

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

Txoj kev sai thiab yooj yim: Ua kom muaj ib qhov chaw SharePoint siv so

Muaj ntau ntau pab ib ncig uas qhia tau tias yuav ua li cas, tab sis kuv nrhiav tsis tau ib tug muab mus-mus txuas, yog li no peb cov.

Koj muaj peev xwm tsim ib qhov chaw SharePoint siv API so.  Ntawm no yog ib tug piv txwv ci siab:

<!--
    SiteRequestForm.html: Sau xov xwm thiab tsim tau ib qhov chaw rau cov neeg siv.
-->

<chaw>
<cov lus>
    <tr>
        <Td>Rau npe:</Td>
        <Td><tswv yim hom= "ntawv nyeem" lub npe= "SiteName" tus ID= "SiteName" /></Td>
    </tr>
    <tr>
        <Td colspan= "2">
            <tswv yim hom= "xa ntawv" tus ID= "CreateSiteButton" tus nqi= "Tsim lub Site" />
        </Td>
    </tr>
</cov lus>
</chaw>

<tsab ntawv src="../Plugins/jquery-1.11.0.min.js"></tsab ntawv>

<tsab ntawv>
Var CreateSiteLogicContainer = {

    createSiteData: {
            "tsis": {
                __metadata: { "hom": "SP.WebInfoCreationInformation" },
                Url: "Paultest1",
                Npe: "Paultest1",
                Hauj lwm lawm: "tsim so web los ntawm Paul!",
                Hais lus: 1033,
                WebTemplate: "sts",
                UseUniquePermissions: tsis tseeb
            }
    },

    createSite: muaj nuj nqi () {

        jQuery.support.cors = tseeb;

        CreateSiteLogicContainer.createSiteData.parameters.Url = $("#SiteName").val();
        
        $.ajax({
            url: "https://bigapplesharepoint.sharepoint.com/NBAIADev/_api/web/webinfos/add",
            txujci: "NCEJ",

            headers: {
                "Txais": "daim ntawv thov/json; odata = verbose",
                "cov ntawv hom": "daim ntawv thov/json;odata = verbose",
                "X-RequestDigest": $("#__REQUESTDIGEST").val()
            },

            cov ntaub ntawv: JSON.stringify(CreateSiteLogicContainer.createSiteData),

            zoo: muaj nuj nqi () { alert("zoo"); },
            yuam kev: muaj nuj nqi () { alert("kev ua yuam kev"); }

        });
    },

    wireUpForm: muaj nuj nqi () {
        $("#CreateSiteButton").nyem(muaj nuj nqi () {
            alert("Li mus sim thiab tsim tau lub site.");
            CreateSiteLogicContainer.createSite();
        });
    }


}

CreateSiteLogicContainer.wireUpForm();

</tsab ntawv>

Thaum zoo, koj tau ib tug JSON tuaj rau lawv teb li no:

image

Kuv xav tseem ceeb thiab learnings ntawm no muaj xws li:

  • Kauj siv jQuery.  Hauv kuv tsev neeg, Kuv lub tsev qiv ntawv jQuery nyob rau hauv "../ plugins. "  Koj mam li xav hais tias yuav kis tau mus rau qhov chaw koj nyiam JQ nyob.
  • Luam thiab paste ntawd cov snippet tag nrho rau hauv ib cov ntawv Editor Web feem ntawm ib sab thiab nws yuav tsum ua hauj lwm xwb fine.  Koj mam xav hloov tag kis API hu thiab xyuas kom tseeb tias koj siv JQ kom raug.
  • Qhov URL yog ntu koj API endpoint.  Hauv kuv tsev neeg, Nws yog ib txoj kev kom ncua chaw kom https://bigapplesharepoint.com
  • Koj tsis tas yuav muab cov ntsiab lus-ntev. Ib co posts uas nyuam thiab MSDN daim ntawv implies tias koj tsis, tab sis tshwm sim rau kuv tau, uas kuv xav tias yog raug leej twg rau $.ajax hu rau nws tus kheej.
  • Cov kab no yuav tsum tau kom tsis txhob muaj qhov lus teb "forbidden": "X-RequestDigest": $("#__REQUESTDIGEST").val().  Muaj ntau hom kev ua, tab sis qhov no yog qhov zoo zoo nkauj.  Kuv tau poob qhov link rau blog muab no shortcut.  H/T rau koj, mysterious blogger!

Hmoov zoo thiab vam cia qhov no yuav pab lwm tus neeg paub.

</kawg>

undefinedSubscribe rau kuv blog.

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

Overcome Annoying teeb meem nrog tus kwv tij Urls hauv SharePoint ceev Launch

Kuv xav mus ntxiv ib qhov txuas rau tus ceev community launch navigation lwm hnub thiab SharePoint hais rau kuv:

image

Ntawv ntshiab version ntawd yog:

Xyuas kom qhov URL no siv tau pib nrog tog twg los ib tug cim uas koj siv tau (ib daim ntawv tooj (#) los luaj pem (/)) los yog ib tug siv tau txaus siab raws tu qauv (Piv txwv, ' http://’, ' https://’, ' ntaub ntawv://’, ' ftp://’, ' mailto:’, ' xov xwm:’).

"Blech thiab qoob!"Kuv hais.

Ib lub workaround rau qhov no yog siv cov JavaScript nrhiav ib qhov txuas paub tias nyob rau lub lub community launch ceev thiab override cov cwj pwm.

Sim no, ntxiv ib qhov txuas tshiab ntawd rau koj lub chaw kuaj thusly:

image

Kuv siv jQuery. Yuav kom daws tau nws, tau ib co JavaScript thiab jQuery mus rau ntawm nplooj ntawv uas siv cov txheej txheem yuav nyiam koj thiab nrog rau ib txoj kab kev cai zoo li no:

 

$(daim ntawv).npaj txhij( muaj nuj nqi () {

    $("ib tug:muaj('Kuaj URL hloov')").nyem(muaj nuj nqi () { alert("nias hloov tus cwj pwm!"); rov qab los tsis tseeb;});

});

Thiab Bob ntawv koj tus txiv ntxawm.

Cov jQuery selector pom txhua txhua <ib tug> lossis tau "Tshuaj ntsuam URL hloov" nws lub npe. Koj yuav tau xyuas-qhib uas nyob ntawm seb koj txuas thiab xws li.

Lub .click(muaj nuj nqi() xijpeem SharePoint yuav tau ua li cas thaum tus neeg siv clicked overrides. Xyuas kom tseeb tias koj "rov qab mus cuav" los yog mus yos nws yuav ua koj cov khoom thiab ces txhob href qhov dhau, Nws yog ib qho yuav luag yeej tsis koj lub hom phiaj no.

Qhov no yog ua li cas thiab kuaj hauv ib SharePoint hauv Internet chaw, tab sis yuav tsum ua hauj lwm zoo ua 2010 thiab dhau hwv.

</kawg>

undefinedSubscribe rau kuv blog.

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

Yooj yim thiab ceev thaum: SharePoint so hu xwb rov qab los 100 Cov ntaub ntawv

Kuv twb ua haujlwm rau ib tug pej xeem facing qhov web site rau kuv SharePoint xyaum no nyob rau hauv New York thiab nws siv ntau hu JavaScript thiab so kom txaus los qhia tias cov.

Thaum lub caij kev khiav, Kuv tsim tau ib dataset me me uas nyuam qhuav 10 los thiaj natwm nyob rau hauv ib daim ntawv teev kev cai thiab kuv tus so txhua txhua rho tawm ntawd.  Thaum kuv tsoo tau daim ntawv los tau ob peb puas natwm cov ntaub ntawv kuaj kev muab hlob, Kuv pom tias kuv tau txais raws nraim 100 xa rov qab rau kuv tus so hu natwm.

Qhov no nws yog ib tug yooj yim heev tshaj plaws rau qhov chaw nyob.  Hauv kuv tsev neeg (thiab kuv ntseeg tias feem ntau), lub neej ntawd so hu rau SharePoint (thiab tejzaum nws ua ib qho kev lag luam txheem?) rov qab los 100 natwm.  Rov qab mus tshaj lub neej ntawd, siv cov $top parameter rau koj, raws li nyob rau hauv:

TAU /Insights Dev/_api/web/lists/GetByTitle('MockBlog')/khoom?$xaiv = ID,Npe,Pawg/Title,Blog_x0020_Author/Title,DatePublished,BlogSummary&$nthuav = Blog_x0020_Author,Pawg&$lim =&$saum = 9999

Kuv yuav khaws 9999 qhov no lawm kuv paub hais tias growth-wise, yuav tsis muaj ntau tshaj 200 los luaj natwm ntxiv rau daim ntawv nyob hauv ib lub xyoos.  Yog hais tias nws yuav ungainly, peb yuav tau siv ib co paging sibtsoo.

</kawg>

undefinedSubscribe rau kuv blog.

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

Yooj yim thiab ceev thaum: Daws "Invalid URL Parameter” qhov teeb meem uas muaj UpdateListItems hauv lists.asmx

Thaum ua hauj lwm nrog cov UpdateListItems ntawm lists.asmx, Nws yog ib qho yooj yim uas ua kom muaj qhov yuam kev:

Invalid URL Parameter.

Qhov URL muaj muaj tus hais kom ua lossis tus nqi uas invalid. Thov khij qhov URL dua.

Koj yuav tau txais qhov yuam kev no thaum uas koj hnov qab xws li daim ID hauv cov daim ntawv uas teb yuav hloov.  Qhov no, zoo li ntau qhov kev pab no SP Web site, yog ib ntsis counterintuitive txij thaum koj yuav tau mus nrog tus ID tus ID attribute ntawm tus <Txujci> caij.  Thiab koj nyob nraum tsis tshiab ID thiab tej zaum koj yeej tsis xav ua tus thawj place.

No lub hnab ntawv uas tsis yog tshuaj ntxuav tes xwb:

<soapenv:Hnab ntawv xmlns:soapenv =' http://schemas.xmlsoap.org/soap/envelope/'>
  <soapenv:Lub cev>                      
    <UpdateListItems xmlns =' http://schemas.Microsoft.com/sharepoint/soap/'>                     
      <listName>{C712E2EA-54E1-47AD-9D99-1848C7773E2F}</listName>                     
        <tshiab>                     
         <Batch OnError ="Mus ntxiv">
          <Txujci ID ="1" Cmd ="Hloov tshiab">
            <Teb Name ="CooperativeLock">muab tub!</Teb>
            <Teb Name ="TUS ID">1</Teb>
          </Txujci>
        </Batch>                     
        </tshiab>                
      </UpdateListItems>             
  </soapenv:Lub cev>         
</soapenv:Hnab ntawv>

Yog hais tias koj tawm tus ID teb siv strip ces koj mam tau txais annoying "Invalid URL parameter" hais.

</kawg>

undefinedSubscribe rau kuv blog.

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