About      |       Articles      |      Services      |      Software      |      Contact

Latest Free SharePoint Software

ARB Security Solutions regularly releases free SharePoint software, including WebParts, Client Applications, Framework Extensions, and other Miscellaneous Components.
The most recent freeware is:

Title: Simple SharePoint Rollup WebPart
Date Published: 10/22/2009

Previous Two Free WebPart Releases:

SecureCenter For SharePoint

By SharePoint security integrators, for SharePoint security integrators.

SharePoint Security Assurance Program™

For externally facing SharePoint deployments, security is an acutely important deployment concern. Learn how through daily security scanning, you can ensure external business users and partners that they can collaborate in confidence!

Security Assurance WebPart:



Getting GAC Path Using Reflection

Recently I was working on a SharePoint timer job for some data synchronization across numerous WebParts. In order to do this I had to load through code the pertinent assemblies from the GAC (I know, I know. I should be using the bin for security purposes, but it is a client request to be in this form) so that I could get access to the various types dynamically.

I found an assortment of sundry techniques that people shared, however I didn’t really dig the sum of string literals that they were using to do it. I am finding that using reflection is much more efficient and clean, so I thought I would post the code snippet for others consumption:

C#:
  1. private static string GacPath()
  2. {
  3. PropertyInfo pi = typeof (Environment).GetProperty("GacPath", BindingFlags.Static | BindingFlags.NonPublic);
  4. if (pi == null)
  5. {
  6. return null;
  7. }
  8. MethodInfo mi = pi.GetGetMethod(true);
  9. return (string) mi.Invoke(null, null);
  10. }

  • Share/Bookmark

Related posts:

  1. ToolPart Class With System.Reflection
  2. Returing Virtual Directory Path From Web Application
  3. MethodBase Without Reflection
  4. Static Versioning in a WebPart EditorPart
  5. Getting a SharePoint Field Value In C#

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment