Quantcast
Channel: Question and Answer » web-services
Viewing all articles
Browse latest Browse all 136

Can we access the sharepoint 2013 list from another web application using CSOM

$
0
0

I have to access the sharepoint 2013 list from the site under another web application in the same farm. Is it possible I tried it but, it is not happening. Both the web applications lie in the same sharepoint 2013 central administration. I tried it by using rest api, also by using javascript,

Following is my code,

<script type="text/javascript">

jQuery.noConflict();

var issueTracklist;

function getItems()
{

    var clientcontext = new SP.ClientContext("http://mypod.pa.bitwiseglobal.com/issuetracker");
    issueTracklist = clientcontext.get_web().get_lists().getByTitle('TicketTracker');   
    var projectcamlQuery = new SP.CamlQuery();      
    projectcamlQuery.set_viewXml("<View><Query><FieldRef Name='ID' /></Query></View>");
    this.issuecollListItem = issueTracklist.getItems(projectcamlQuery); 
    clientcontext.load(issuecollListItem);  
    clientcontext.executeQueryAsync(Function.createDelegate(this, this.onIssueTrackSucceeded), Function.createDelegate(this, this.onIssueTrackFailed));

}

function onIssueTrackSucceeded(sender,args)
{
    alert(issuecollListItem.get_itemCount());
}

function onIssueTrackFailed(sender,args)
{
    alert('Request failed. ' + args.get_message() + 'n' + args.get_stackTrace());
}

</script>

Viewing all articles
Browse latest Browse all 136

Latest Images

Trending Articles



Latest Images