Skip to main content

Posts

Showing posts from August 7, 2011

How to retrieve the url of the attachment associated with the list item?

Dudes,           It is very simple.Before I tried in many ways.I felt this one is the simple approach.Once after you get the listItem ,ie.SPListItem follow the procedure as shown below. string name=string.Empty; splistitem item=list.GetItems(queryItems)[0]; foreach(string file in item.Attachments) {     name=item.Attachments.UrlPrefix+file;  }  return name;

How to access the attachment of sharepoint list Item?

This question sounds pretty interesting.We all know that we can access the list items from the list easily. Perhaps we may not be had used this concept.Yes we cam access the attachment of the list item in this way:   foreach(string filename in listiem.Attachments) {    SPFile file=listItem.parentLis.ParentWeb.GetFile(listItem.Attachments.UrlPrefix+filename);   //do whatever u wanted to do }

What is the use of static class?

I was wonder before why we need to make some  classes  as static.The reason is very simple.You can make use of its member without instantiating the object of that class.For example public static class   Name() {      Name()       {}      public static string PersonNames()       {          //do some stuff here          return stringObject;        } } If you want to access the PersonNames() method in another class ,you don't need to do much.Just className.methodname(); ie. public class CitizenDetails() {  Name.PersonNames(); //do further stuff }