Abbas
Abbas

Reputation: 14432

Is it possible to change values in resource (.resx) file?

I have a SharePoint 2010 project with a feature. This feature will create an SPList on activation if it doesn't exist yet. When creating an SPList, the Add() method returns a Guid. I want to store this Guid in the resources file but I haven't found a way to do this. I know how to fetch items from the resources file but not how to update values. Is there a way to do this or not? If not, then what is the best approach to store values?

Thanks in advance!

Upvotes: 1

Views: 1025

Answers (1)

Dennis G
Dennis G

Reputation: 21788

You don't want to use a resource file to store configuration values - a resource file's intend is for localizing strings.

You should use either one of these:

  • SharePoint Property Bags, e.g. ListItem.Properties or SPWeb.AllProperties
  • A hidden SharePoint "configuration list"
  • The web.config to store your AppSettings

In your case you want to store the list GUID somewhere I would suggest storing it in the SPWeb property bag and you can later retrieve it by using SPWeb.AllProperties['MyCustomListGUID']

Upvotes: 1

Related Questions