3

I'm looking into changing the text on the emails which are sent out after a user clicks the Request Access link on an Access Denied page in MOSS (2007).

This blog post has some helpful information, which pointed me to the RequestAccess class within the Microsoft.SharePoint.ApplicationPages assembly. By creating my own version of this class, installing it in the GAC, and changing the code-behind references for reqacc.aspx to my class, I've verified that I can manipulate the email being sent. However, the SendEmail() method there works from a template string and uses string.Format() to provide it with parameters.

In order to really change the text, it looks like I'll either need to throw out most of what the OOTB page is doing and re-create it, or modify that base template string. Ideally, I might not even need to make any changes to this class at all, if I can make my changes to the base string.

The problem is I can't find that base string. It should be identified as either "RequestAccessEmailBody1" or "RequestAccessEmailBody1List" (depending on the location which the access request is coming from), but I can't find either of these keys in wss.en-US.resx (from the IIS site directory, "C:\Inetpub\wwwroot\wss\VirtualDirectories\80\App_GlobalResources" for me) or any other .resx file I've searched in.

The pseudo-code version of the code I'm looking at from a decompiled version of RequestAccess.cs is:

emailBody = string.Format(SPResource.GetString("RequestAccessEmailBody1", userName), linkToServer, grantAccessLink, ... );

And the actual, horribly ugly, decompiled version is:

string[] strArray3 = new string[] { string.Format(SPHttpUtility.HtmlEncode(
        SPResource.GetString(flag ? "RequestAccessEmailBody1" : 
        "RequestAccessEmailBody1List", new object[] { name })), "<a href = \"" + 
        SPHttpUtility.UrlPathEncode(serverRelativeUrl, true) + "\">" + 
        SPHttpUtility.HtmlEncode(serverRelativeUrl) + "</a>"), "<BR/><BR/>",
        SPHttpUtility.HtmlEncode(SPResource.GetString("RequestAccessEmailBody1b", 
        new object[0])), "<BR/><BR/>- ", str7, 
        SPHttpUtility.HtmlEncode(SPResource.GetString(flag ? "RequestAccessEmailBody2" : 
        "RequestAccessEmailBody2List", new object[] { name })), 
        "</a><BR/><BR/>- <a href = \"", SPHttpUtility.UrlPathEncode((flag ? str9 : str8)
        + "setrqacc.aspx", true), "?type=", SPHttpUtility.UrlKeyValueEncode(flag ? 
        "web" : "list"), flag ? "" : ("&name=" +  
        SPHttpUtility.UrlKeyValueEncode(this.m_strListID)), "\">", 
        SPHttpUtility.HtmlEncode(SPResource.GetString(flag ? "RequestAccessEmailBody3" : 
        "RequestAccessEmailBody3List", new object[0])), "</a><BR/><BR/>", str10,
        SPHttpUtility.HtmlEncode(SPResource.GetString("DoNotReplyText", new object[0]))
        };
string txtMessageBody = string.Concat(strArray3);

Anyone know where these strings (RequestAccessEmailBody1 and RequestAccessEmailBody1List) are?

2 Answers 2

1

According to MSDN, the SPResource methods retrieve the localized strings from the microsoft.sharepoint.intl.dll assembly, not .resx files.

[I don't have access to SharePoint assemblies at the moment to decompile them and confirm this information - if you do it, post a comment or edit this answer and write what you found.]

2
  • As a quick follow-up, it seems that Microsoft.SharePoint.intl.dll only exists (at least for me) in the GAC (nowhere under C:\Program Files), which is proving a bit challenging to decompile (I'm new to Reflector, so I might just be doing something wrong)
    – Dave
    Sep 28, 2011 at 13:23
  • @Dave: Did you try to access the assembly? Just use Total Commander to browse the folder c:\Windows\assembly - the actual paths of GAC assemblies look like this: c:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.InfoPath\14.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.InfoPath.dll. Sep 28, 2011 at 14:19
0

I have 2 tips here:

  • Download Agent Ransack, it's a free utility that allows you to search inside text files, dll's and zip and it's fast (and it actually works unlike the built in search in windows :-D)! I use it all the time when i need to find a particular string in a folder. during installation, choose to have it available in the Windows (Explorer) Shell and then you can just right click on the 14 hive!

  • Download ILSpy, it from the SharpDevelop team and it's completely free, unlike Reflector and allows for easy access to any assembly, located in the GAC or somewhere else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.