Month: October 2013

Client object Model managed Code C# SharePoint


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Client;
namespace SPClient.NetConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            ClientContext clientContext = new ClientContext(http://igtehydzbnv02:8811/);
            Web site = clientContext.Web;
            List list = site.Lists.GetByTitle(“TestListFilter”);
            CamlQuery query = newCamlQuery();
            ListItemCollection itemColl = list.GetItems(query);
            clientContext.Load(itemColl);
            clientContext.ExecuteQuery();
            Console.WriteLine(“Count: {0}”, itemColl.Count);
            for (int i = 0; i < itemColl.Count; i++)
            {
                Console.WriteLine(itemColl[i][“Title”]);
            }
            Console.ReadLine();
        }
    }
}
Advertisements

Show SharePoint Error Page instead of Yellow ASP.Net error page

To show SharePoint errorpage do below changes in Web.Config file:

<SafeModeMaxControls=200CallStack=falseDirectFileDependencies=10TotalFileDependencies=50AllowPageLevelTrace=false>

and

<customErrorsmode=On />

To See Error message on Page itself do below changed in Web.Config file

<SafeModeMaxControls=200CallStack=true”DirectFileDependencies=10TotalFileDependencies=50AllowPageLevelTrace=false>

and

<customErrorsmode=Off />

Check dupliacte in list SharePoint ECMA Script : Client object model

Screen Shots:-

 

 Solution:-

//Get the list item from the Announcements list whose Id is 4. Note that this is the ID of the item in the list, not a reference to its position in the collection.
var itemId = 1;
var targetListItem;
var collListItem;
function runCode(txtBoxValue) {
alert(txtBoxValue);
var clientContext = new SP.ClientContext();
var targetList = clientContext.get_web().get_lists().getByTitle(‘TestECMAList’);
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(”+txtBoxValue+’10’);
collListItem = targetList.getItems(camlQuery);

//targetListItem = targetList.getItemById(itemId);
clientContext.load(collListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
function onQuerySucceeded() {

//alert(‘Request succeeded. \n\nRetrieved Item is: ‘ + targetListItem.get_item(‘Title’));
var listItemInfo = ”;
var listItemEnumerator = collListItem.getEnumerator();

while (listItemEnumerator.moveNext()) {
var oListItem = listItemEnumerator.get_current();
listItemInfo += ‘\nID: ‘ + oListItem.get_id() +
‘\nTitle: ‘ + oListItem.get_item(‘Title’) ;
}
if(listItemInfo.toString()==””)
{
alert(‘Item not found’);
}
else
{
alert(listItemInfo.toString());
}

}
function onQueryFailed(sender, args) {
alert(‘Request failed. \nError: ‘ + args.get_message() + ‘\nStackTrace: ‘ + args.get_stackTrace());
}

Application pool keeps stopping / Service Unavailable in SharePoint Site / 503 error in SharePoint Site

One cause for this issue can be change in password for account with which Application pool is running for changing the Managed account password follow below blog post:
(Never change it from IIS directly)
 
If this is not your case then it can be below issue:
If you check the eventvwr logs you will see below entry in it:
The Module DLL ‘C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\isapi\owssvr.dll’ could not be loaded due to a configuration problem. The current configuration only supports loading images built for a x86 processor architecture.
 
Solution:
1.       Open IIS by typing inetmgr in RUN.
2.       Click on Application pools
3.       Click on particular Application pool for your site
4.       Right Click Advance settings
5.       Set Enable 32-bit applications to false

 

Error While Adding/ Retracting SharePoint WSP

Error In PowerShell

Install-SPSolution : Admin SVC must be running in order to create deployment ti
mer job.

Error In Central Admin

The timer job for this operation has been created, but it will fail because the administrative service for this server is not enabled.

Solution:-

1. Go to Run
2. Type Services.msc
3. Start SharePoint 2010 Administration Service