Skip to main content

Posts

Showing posts from March, 2012

CAML Query Helper Class

http://sharepointcamlhelper.codeplex.com/ https://camldotnet.svn.codeplex.com/svn/JohnHolliday.Caml.Net/CAML.cs CAMLManager mgr = new CAMLManager(); mgr.QueryGroups.Add(new QueryGroup("Title", Types.FieldTypes.Text, Types.QueryTypes.Eq, "A Title")); mgr.QueryGroups.Add(new QueryGroup(Types.JoinTypes.Or, "Title", Types.FieldTypes.Text, Types.QueryTypes.Eq, "Another Title")); mgr.QueryGroups.Add(new QueryGroup(Types.JoinTypes.And, QueryGroup.MergeTypes.Contain, "Total", Types.FieldTypes.Number, Types.QueryTypes.Geq, "2")); string caml = mgr.GetCAML(); Will provide the following: <Where>   <And>     <Or>       <Eq>         <FieldRef Name="Title" /><Value Type="Text">A Title</Value>       </Eq>       <Eq>         <FieldRef Name="Title" /><Value Type="Text">Another Title</Value>     ...
Creating Custom Field for Email Validation http://www.c-sharpcorner.com/uploadfile/Roji.Joy/creating-a-custom-field-type-for-sharepoint-2010-email-validation-field/
Membership.CreateUser(Loginid, Password, Emailid); Error : Object Reference not to set an object Solutions: 1)Continue to rely on SPClaimsAuthMembershipProvider and obtaining HttpContext.Current Just instantiate the HttContext.Current If it is null: if (HttpContext.Current == null) { HttpRequest request = new HttpRequest(String.Empty, sp_web.Url, String.Empty); HttpContext.Current = new HttpContext(request, new HttpResponse(new StringWriter())); } If you instantiated new HttpContext, it would be good to reset it at the end of your methods back to null. Just make sure this happens only if HttpContext.Current was null at the beginning. 2)Working with the SqlMembershipProvider and forgetting about HttpContext.Current issue What we need is to get the SqlMembershipProvider from registered providers and to start using it. SqlMembershipProvider sqlMembershipProvider = (SqlMembershipProvider)Membership.Providers["FBAMembershipProvider"]; Bear in mind that you ...

How to store the sharepoint List or List Item within the recycle bin of the site while deleting it programmatically ?

Whenever we delete a sharepoint list or list item from the User Interface it get stored within the recycle bin of the site. But when we delete it programmatically it get's deleted permanently. So what we can do to store the List or List Item within the recycle bin while deleting it programmatically ? Generally we use the list.Delete() or item.Delete() method to delete the list or item. Instead of using the Delete() method we can use the Recycle() method i.e list.Recycle() or item.Recycle(). This will store the item within the recycle bin.