Saturday, March 5, 2011

CAML Query: FieldRef Element

The CAML  FieldRef contains DisplayName and Name respectively.

DisplayName refers to the name shows in the browser.


Name refers to the internal name which cannot be changed once you create it. If you do not modify it before, Display and Name are the same. 

On the other hand, if you modify it, you can find the Name through the link shown in the browser.First, you can click the column that you want to know its Name. Then, you will discover that the link shown in the browser have changed. 


In the above picture, the value of SortField equals the Name of the column.
In the CAML Query, it uses Name to search items only. Therefore, do not use DisplayName to do a query.



REST: Data service client code-generation failed: Schema specified is not valid

When I add REST Interface as a service reference in a c# projcet, an error message is shown below:


In the above message, it tells me that "Schema specified is not valid". "__x_notify_Item" is invalid"  shows that a list named "__x_notify" contains some special characters which is not accepted by the schema. 



Delete the specified list, the problem will be solved.

Sunday, January 23, 2011

Sharepoint foundation: cannot perform a backup

When I click Perform a backup in the Central Administration,
an error message "Administration service is stopped. Start the Microsoft SharePoint Foundation Administration 2010 service in order for the operation to continue." is shown below:

Since I do not start the administration service, I go to start the service by going to Administrative Tools -> Services. Then , I click SharePoint 2010 Administration and start it.

After that, the error message will be disappeared.

Wednesday, January 19, 2011

REST: CRUD authentication in C#

DefaultCredentials:
"The DefaultCredentials property applies only to NTLM, negotiate, and Kerberos-based authentication. DefaultCredentials represents the system credentials for the current security context in which the application is running. For a client-side application, these are usually the Windows credentials (user name, password, and domain) of the user running the application. For ASP.NET applications, the default credentials are the user credentials of the logged-in user, or the user being impersonated."

DefaultCredential in C#

context.Credentials = CredentialCache.DefaultCredentials;
projectsBindingSource.DataSource = context.Projects;
If you don't want to use current window credentials, you can using the following code:

ICredentials cache = new NetworkCredential("username", "password", "domain");
context.Credentials = cache;

Tuesday, January 18, 2011

REST: System.Data.Services.Providers.IDataServiceUpdateProvider

When I go to http://yoursite/_vti_bin/listdata.svc using rest service in SharePoint Foundation 2010, I get an error which is shown below:


The solution is : install ADO.Net data Services Update for .Net Framework 3.5 SP1

For windows 7 & windows server 2008 r2 :


For windows 2000, windows xp, windows vista, windows server 2003 & windows server 2008:




Sunday, January 9, 2011

SQL Server: Connection to target machine could not be made in a timely fashion

I cannot start SQL Server Configuration Manager suddenly and a message box is shown below:





The thing I need :  restart the computer or SQL service. 


When I update the account password which used to run this service, this error will be occurred. Then, go to SQL Server Configuration Manager and update password of the account. After restart the service, everything works fine.

Sunday, January 2, 2011

SharePoint foundation: incoming emails do not trigger workflows

"This problem occurs because a security fix in Windows SharePoint Services 3.0 SP1 prevents declarative workflows from starting automatically under the system account. E-mail enabled list items are always created under the system account."


By default, sharepoint foundation will not trigger the workflow by emailed items. In order to enable this property, you need to type some commands




1. "stsadm -o getproperty -pn declarativeworkflowautostartonemailenabled"



2. "stsadm -o setproperty -pn declarativeworkflowautostartonemailenabled -pv true"


Reference: http://support.microsoft.com/kb/953289