How to read custom list items from personal My Site Host into a different site collection


we have custom list "my site host" personal site each user.

that custom list permit to user add personal information.

we want show ítems belong user in "another" site collection, in main site.

personal site url "https://site-my.domain.com"

site collection "https://site.domain.com"

custom list called "mypersonalcontacts"

when user access sharepoint personal site, see newsfeed , personal contacts ítems custom list.

this same mypersonalcontacts list ítems must showed en home site belong site collection.

question:

how read items mypersonalcontacts "https://site-my.domain.com" into "https://site.domain.com"?

 issues discovered:

1.- using clientcontext en jsom doesn´t work when different site collection, using permission in app tenant doesn´t work

 we try sample

http://www.sharepointnutsandbolts.com/2012/11/access-end-user-data-in-host-web-from.html

2.- rest api send "403:forbidden", have assign "x-requestdigest" : formdigestvalue in header, dont' work.

from simple: http://msdn.microsoft.com/en-us/library/jj164022.aspx

3.- sp.webproxy , sp.webrequestinfo with x-requestdigest set have access denied error (remoteendpoint assigned)

this simple work when our remote webservice don´t have user authentication, site host, want pass authentication, "x-requestdigest" was not worked

http://code.msdn.microsoft.com/office/sharepoint-2013-get-data-705bdcd5/sourcecode?fileid=67632&pathid=1102161389

we have add endpoint , permission tenant in sharepoint hosted app

 is permission restriction using "my site host" site different site collection?


efrenca

finally works!

remoteendpoint not difference, share steps make work in scenario.

scenario:

we need app configure personal custom list in current user “my site”.

this app must read personal custom list items user added , read other items root custom list other site collection (hr) contributor site added.

the app show table information 2 different list in different site collections

environment used:

sharepoint 2013 online preview

site collections

main: https://site.sharepoint.com

my site host: https://site-my.sharepoint.com

hr: https://site.sharepoint.com/site/hr

app site: http://app-site.sharepoint.com

sharepoint-hosted app

appmanifest.xml

i have additional configuration

  <appprincipal>

    <internal allowedremotehosturl="~remoteappurl"/>

  </appprincipal>

  <apppermissionrequests>

    <apppermissionrequest scope="http://sharepoint/content/tenant" right="manage" />

  </apppermissionrequests>

permissions required tenant , manage right, app need read items, add items , create custom list item different site collections.

this script lists item personal list. share example reproduce cross site call.

var allitems;

function readdata() {

    var targeturl = "https://site-my.sharepoint.com"; //it read tokens

    var ctx = new sp.clientcontext(appweburl); //appweburl taken tokens

    var appcontextsite = new sp.appcontextsite(ctx, targeturl);

    web = appcontextsite.get_web();

    var list = web.get_lists().getbytitle("customlist");

    var camlstring =

        "<view><viewfields>" +

            "<fieldref name='title' />" +

        "</viewfields></view>";

    var camlquery = new sp.camlquery();

    camlquery.set_viewxml(camlstring);

    allitems = list.getitems(camlquery);

    ctx.load(allitems, "include(title)");

    //execute query previous 

    //  options , parameters

    ctx.executequeryasync(

        successmetadata, errorgetmetadata

    );

}

issues founded:

1. if debug app visual studio 2012, app don’t work, access denied exception throw when cross domain call executed, yes, accept trust dialog trust app in tenant.

2. if install manually app using napa avoid retract app when stop debug, app don’t work, same access denied exception throw.

finally found article install app in corporate store , cross site calls worked j.

workaround:

1. need create new site collection store apps in corporate catalog, go sharepoint admin center, site collections, create new app store catalog.

my catalog https://site.sharepoint.com/site/apps

2. in visual studio publish app generate de app file upload app catalog.

3. when site successful created, apps sharepoint catalog created, section, create new app , upload app file.

4. after upload app, enter site content app store site , add app, select cross site app , accept trust dialog install.

5. after app installed click callout app , select deployment option, (this option make magic), select site collection need , install app. deployment process take around 30 minutes approx. user can see apps in main site.

6. installed app can request cross site calls site collections needed.

learning:

according resources read.

“when developing app , deploying sharepoint development tools in microsoft visual studio 2012, validation checking not occur.”

this step important when use cross site calls different site collections app.

how debug:

using developer tool ie (f12) can debug app

resources:

deploying , installing apps sharepoint: methods , options

http://msdn.microsoft.com/en-us/library/fp179933.aspx

tenancies , deployment scopes apps sharepoint

http://msdn.microsoft.com/en-us/library/fp179896.aspx

solving cross-domain problems in apps sharepoint

http://blogs.msdn.com/b/officeapps/archive/2012/11/29/solving-cross-domain-problems-in-apps-for-sharepoint.aspx

source code- sharepoint 2013: bookstore, using custom actions , cross-domain library

http://code.msdn.microsoft.com/office/sharepoint-2013-bookstore-328060fc


efrenca



SharePoint  ,  Apps for Office and SharePoint  >  Developing Apps for SharePoint 2013



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'