Posts

Showing posts from December, 2014
caml query not returning selected value from choice field : so an inverse select ex: if you want to get which are yes or true make it not equal to no or false . NEQ --> no or false of that field <Neq><FieldRef Name='filename' /><Value Type='Boolean'>No</Value></Neq>
Filter results from a data table c# ex: get unique  values of a coloumn , DataView view1 = new DataView(datatable1);                         distinctValues1 = view1.ToTable(true, "user");                         DataRow[] values1 = distinctValues1.Select(" ");                         int numberofitems= values1.Count(); //this gives you count of unique rows you can access info of that unique rows from values1 array .
format date to YYMMDD   . c#  (.net ) DateTime theDate = DateTime.Now.AddDays();                     string thedate = (theDate).ToString("yyMMdd");
.net console application execute as differnet user : or .net  read file as a different user etc :  using (UserImpersonation user = new UserImpersonation(uname, Domain, pass))             {                 if (user.ImpersonateValidUser())                 {                     //write your code to read file or access items etc ..                  } } wehn you run the code you can see if you are successful to login as that user or not .if you are logged it it show old user and impersonating user details . right click on U serImpersonation: and select generate a class : ADD THIS CODE TO THAT GENERATED CLASS FILE : make sure you add inherit from idisposable . class UserImpersonation: IDisposable     {         [DllImport("adva...
SharePoint  CSOM impersonation  : or login as different user CODE: using (ClientContext ctx = new ClientContext("https://yourweburl.net"))                 {                     ctx.Credentials = new NetworkCredential(username, password, domain); } }