I have a sharepoint 2010 website with anonymous access. here i want to add a list item to the list as anonymous user.am given whole website access to anonymous.when am trying to add list item am getting access denied error.am using sharepoint foundation 2010 version. here is my java script code.

 <script type="text/javascript">
    ExecuteOrDelayUntilScriptLoaded(MainFunction, "sp.js"); 
    function submit123(){
    function createListItem() {
           var clientContext = new SP.ClientContext.get_current();
           var oList = clientContext.get_web().get_lists().getByTitle('SIP');        
           var itemCreateInfo = new SP.ListItemCreationInformation();
           this.oListItem = oList.addItem(itemCreateInfo);        
           oListItem.set_item('Title', 'My New Item!');    

           clientContext.executeQueryAsync(Function.createDelegate(this,  this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));

        function onQuerySucceeded() {
                alert('Item created: ' + oListItem.get_id());

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


Please allow anonymous access on list also on which you want to add the listitem.

Here are the detailed steps:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.