kamagra how much to take

Getting A Specific SPListTemplateType Icon

MORE INFO: To answer a question I received about this, if you have a hydrated SPList you can use the SPList.BaseTemplate property as a reasonable parameter.

Unfortunately, I haven’t found a *good* way to do this. You are basically forced either to put in a grip of if statements (yuck!) or just put in a simple switch/case. Since it is boring to look up all the image names in the 12 hive, I will make your live easier for you. Just use this helper method which will consume a SPListTemplateType as a parameter. Following, it will recur through and return a string providing the path to the list icon in order to support your interface needs.

  1. public static string RetrieveListIcon(SPListTemplateType type)
  2. {
  3. switch (type)
  4. {
  5. case SPListTemplateType.DocumentLibrary:
  6. return "/_layouts/images/itdl.gif";
  7. case SPListTemplateType.Announcements:
  8. return "/_layouts/images/itann.gif";
  9. case SPListTemplateType.Events:
  10. return "/_layouts/images/itevent.gif";
  11. case SPListTemplateType.Links:
  12. return "/_layouts/images/itlink.gif";
  13. case SPListTemplateType.Tasks:
  14. return "/_layouts/images/ittask.gif";
  15. case SPListTemplateType.DiscussionBoard:
  16. return "/_layouts/images/itdisc.gif";
  17. case SPListTemplateType.PictureLibrary:
  18. return "/_layouts/images/itil.gif";
  19. case SPListTemplateType.IssueTracking:
  20. return "/_layouts/images/ITISSUE.GIF";
  21. default:
  22. return "/_layouts/images/itgen.gif";
  23. }
  24. }

One Comment

  1. Saikat Biswas says:

    Few more from my side…

    public static string RetrieveListIcon(SPListTemplateType type)
    switch (type)
    case SPListTemplateType.DocumentLibrary:
    return “/_layouts/images/itdl.gif”;
    case SPListTemplateType.Announcements:
    return “/_layouts/images/itann.gif”;
    case SPListTemplateType.Events:
    return “/_layouts/images/itevent.gif”;
    case SPListTemplateType.Links:
    return “/_layouts/images/itlink.gif”;
    case SPListTemplateType.Tasks:
    return “/_layouts/images/ittask.gif”;
    case SPListTemplateType.DiscussionBoard:
    return “/_layouts/images/itdisc.gif”;
    case SPListTemplateType.PictureLibrary:
    return “/_layouts/images/itil.gif”;
    case SPListTemplateType.IssueTracking:
    return “/_layouts/images/ITISSUE.GIF”;
    case SPListTemplateType.Survey:
    return “/_layouts/images/itsurvey.GIF”;
    case SPListTemplateType.WorkflowProcess:
    return “/_layouts/images/ITWFH.PNG”;
    case SPListTemplateType.TextBox:
    return “/_layouts/images/ITTXTBOX.GIF”;
    case SPListTemplateType.Agenda:
    return “/_layouts/images/ITAGNDA.GIF”;
    case SPListTemplateType.Categories:
    return “/_layouts/images/ITCAT.GIF”;
    case SPListTemplateType.Comments:
    return “/_layouts/images/ITCOMMNT.GIF”;
    case SPListTemplateType.Contacts:
    return “/_layouts/images/ITCONTCT.GIF”;
    case SPListTemplateType.DataSources:
    return “/_layouts/images/ITDATASH.GIF”;
    case SPListTemplateType.Decision:
    return “/_layouts/images/ITDECIS.GIF”;
    case SPListTemplateType.Posts:
    return “/_layouts/images/ITPOSTS.GIF”;
    case SPListTemplateType.MasterPageCatalog:
    return “/_layouts/images/itdl.gif”;
    case SPListTemplateType.WebPartCatalog:
    return “/_layouts/images/itdl.gif”;
    return “/_layouts/images/itgen.gif”;

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>