Hloov tshiab: Marc AD ndersson taw tes qhia tawm no zoo kawg thiab daim info: http://blogs.Office.com/2014/08/13/json-Light-Support-rest-sharepoint-API-Released/. Uas piav txog heev :).
Uas tej zaum yuav tau lub npe phem ntawm ib cov ncej blog puas! Anyhoo.
Kuv mas ua rau kuv prototyping rau thaj O365. Kuv tau kuv tus kheej lom kom kuv tsis muaj yuav txhawj xeeb txog koj rau leej twg. Ua tus ib cag-nco thaum peb hu kwv ncig cov cav tov virtual rau peb laptops nrog NTXHUAB – SQL neeg rau zaub mov, IIS, txiav txim siab seb vs Hyper-V. VMWare? Anyhoo...
Kuv tau tsim ib qho app Angular siv nyob rau hauv qhov chaw uas puas, cov lwm yam, qhov no:
$http.Get(serverUrl)
.zoo(muaj nuj nqi(cov ntaub ntawv, xwm txheej, headers, config) {Var getLinksResponse = ntaub ntawv;
getLinksResponse.value.forEach(muaj nuj nqi(theResult) {
// li ntawd thiab ces froth
Qhov no yog ua hauj lwm xwb fine ob hom SharePoint nyob rau hauv tej kev kawm. Txawm li cas los, Thaum twg kuv colleague ported nws mus rau ib Cloudshare lom, nws tsis yog ib tug HTTP 406 yuam kev (uas yog thawj zaug kuv puas tau mus txog ntawd ib tug, vim li ntawd... yay, tej zaum). Peb puas muaj me ntsis kev soj ntsuam thiab pom tias header uas muaj "Txais" tus ntawd tawm. SharePoint hauv Internet yog txawm zoo siab nrog:
Txais: daim ntawv thov/json
Tab sis qhov cloudshare lom (Nws yog ib qho SP rau prem, hosted rau ib tug neeg rau zaub mov virtual) xav qhov classic "odata = verbose" ntxiv rau kom zoo:
Txais: daim ntawv thov/json;odata = verbose
Kho uas, peb ntxiv cov header zoj:
Var config = {headers: {
'Lees': ' thov/json;odata = verbose'
}
};$http.Get(serverUrl,config)
.zoo(muaj nuj nqi(cov ntaub ntawv, xwm txheej, headers, config) {Var getLinksResponse = ntaub ntawv;
getLinksResponse.value.forEach(muaj nuj nqi(theResult) {
// li ntawd thiab ces froth
Uas tau mus tua ntawm tus 406, tiam sis nws kuj hloov cov hom ntawv uas yuav teb. Yog xav paub ntxiv … verbose. (haha!) Muaj ntau yam hloov ntxiv yuav tsum thiab nov yog qhov tshwm sim zaum kawg:
Var config = {headers: {
'Lees': ' thov/json;odata = verbose'
}
};$http.Get(serverUrl,config)
.zoo(muaj nuj nqi(cov ntaub ntawv, xwm txheej, headers, config) {Var getLinksResponse = ntaub ntawv;
getLinksResponse.d.Results.forEach(muaj nuj nqi(theResult) {
// li ntawd thiab ces froth
Qhov no tsuas txia ntshis ua ib tug 30 teeb meem feeb rau peb, kom peb lucked. Hopefully ib tug neeg pom qhov no pab tau.
</kawg>