Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Config for Document Event Handler

  Asked By: Lacy    Date: Oct 22    Category: Sharepoint    Views: 1479

What is the recommended place to store config info for document event
handlers? Considering that the DLL will go into the GAC -- where does
one store config files for it?

Share: 

 

8 Answers Found

 
Answer #1    Answered By: Jagdish Joshi     Answered On: Oct 22

You can store  it in web.config of your virtual directory.

 
Answer #2    Answered By: Shara Johnson     Answered On: Oct 22

I'm assuming that after that I need to do:

[C#]
NameValueCollection config  = (NameValueCollection)
ConfigurationSettings.GetConfig("...");

Is that correct?

Thanks, I'll give it a try.

 
Answer #3    Answered By: Victoria Bell     Answered On: Oct 22

In web.config, declare connection setting under <configuration>

<connectionStrings>
<add name="ConnectionString" connectionString="Data
Source=ServerName;Initial Catalog=DBName;User ID=UserID;
PasswordPassword;Trusted_Connection=no;Connection Timeout=30"
providerName="System.Data.SqlClient" />
</connectionStrings>

In your code, you can retrive it as follow
//Import namespace
using System.Configuration;

private string Get_Connect_String()
{
return ConfigurationManager.ConnectionStrings
["ConnectionString"].ConnectionString;

}

 
Answer #4    Answered By: Cassidy Sharpe     Answered On: Oct 22

The code works fine in development machine but
not on production. We have farm of two front-end
servers and I installed the event  handler on both
but it does not seem to find web.config.

 
Answer #5    Answered By: Linda Mason     Answered On: Oct 22

Have you modified web.config on both servers?

 
Answer #6    Answered By: Hans Weiss     Answered On: Oct 22

Yes I have. The code runs because it writes to the EventLog the
message I coded to write when it cannot find web.config file (actually
when the value I'm reading is null.)

 
Answer #7    Answered By: Alison West     Answered On: Oct 22

Yes I have. The code runs because it writes to
the EventLog the message I coded to write when
it cannot find web.config file (actually when
the value I'm reading is null.)

I've now got around that problem by creating a
new XML file in the virtual directory running
the portal.

I've however got into another problem:

I need to update the user profile and need to
instantiate UserProfileManager class. This code

SPWeb web = listEvent.Site.OpenWeb()
PortalContext portalContext =
PortalApplication.GetContext(web.Site.ID);
UserProfileManager upm =
new UserProfileManager(portalContext);

works in dev but not production environment.

 
Answer #8    Answered By: Freddy Heath     Answered On: Oct 22

I'm assuming that after that I need to do:
[C#]

NameValueCollection config  = (NameValueCollection)

ConfigurationSettings.GetConfig("...");
Thanks, I'll give it a try.

 
Didn't find what you were looking for? Find more on Config for Document Event Handler Or get search suggestion and latest updates.




Tagged: