Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

create a sub folder "Resource"

  Asked By: Raymond    Date: Sep 10    Category: Sharepoint    Views: 2708

The site below:

blog.spsclerics.com/.../Category.aspx?Name=CAML


Describes how to use a resource file in a feature


"<Module Path="PageTemplates" Url="$Resources:UrlLib" >

....


1) create a sub folder "Resource"


add some resx file into like Resources.resx (or whatever)"


I'm assuming this means from my featurename/Resources folder I can have
a file featurename/Resources/BYUIcore.resx


And reference it as follows????:

<Property Name="Title" Value="$Resources:BYUIcore,University;" />

(I'm a little confused because I know it should be
$Resources:Language,String but this example from SPS/Onet.xml threw me
for a loop -- $Resources:core,doctemp_Excel. Doesn't core refer to
core.resx?)



I created my resx file, and put it in to place. I tried several ways to
reference it:

$Resources:BYUIcore,University;

$Resources:Resources,University;

$Resources:en-us,University;

$Resources:University;

$BYUIcore:University


But I always get in the field the literal '$Resources:University'


I also tried [ DefaultResourceFile="Resources\BYUIcore.resx" ] in the
Features.xml file and wasn't sure if I had to also add an entry: [
<ElementFile Location="Resources/BYUIcore.resx" /> ]

What am I missing, what have I done wrong? The website above doesn't
make specific reference to the 12 Hive Resource folder, and it looks
like it can be within my feature which is what I'd prefer to do.

If none of this works, can a Feature copy the resx file into the hive
Resources folder? Or do I have to use a solution to do that?

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Deven Gajjar     Answered On: Sep 10

The Blog defines how to use a Resource file  in a Feature. Not how to
deploy a Resource file with a Feature. Features can only deploy files
to the site  or a library on a site. To deploy files to the 12 hive of a
Front end server you would use a Solution (WSP).

The point he was making in the Blog was that if you use something like a
relative path repeatedly in a feature  you might want to put  it in a
.RESX file so that you don't have to change it in multiple places if you
decide to change it.

SharePoint will look for resx  files in two places in the 12 hive. It
looks in the Resources directory in the root of the 12 hive and in the
Resources directory, if any, in the root of the Feature itself. First
it looks for a file that contains the abbreviation for the culture code
of the site. If it doesn't find that file it looks for a file with the
same base name but no culture code. So if the site is using US English
then it looks for a file named Something.en-us.resx in the Resources
directory. If it doesn't find that then it looks for Something.resx.
Resource files located in the Feature subdirectory can only be used
within that Feature and always use the base name Resources. Take a look
at the SlideLibrary feature for an example.

 
Answer #2    Answered By: Latisha Schneider     Answered On: Sep 10

The blog  link was slow earlier this morning, so thank you so much for
describing it in detail.

I really believe the archives of these threads will be very useful to
those who follow.

It worked! In my feature folder  I have Resources/Resources.en-US.resx
and Resources/Resources.resx (I understand I only needed one)

I removed the ElementFile reference  to Resources.resx it since I don't
need it there.

I noticed on the Slide Library feature  they use
DefaultResourceFile="_Res" but it works  without it too.



Regarding my previous thread where I wanted to create  subdirectories:

<Module ... Url="_custom/Library/SubDir" ...> will create the
subdirectories for you, as stated in MSDN.



When you use type=Ghostable you do not need to create a ListInstance.

If you change to type=GhostableInLibrary then it will throw an error



Failed to instantiate file  "provisionablefile.aspx" from module
"Module": The specified list does not exist.


So you have to add  a ListInstance:

<ListInstance

FeatureId=""

TemplateType="101"

Title="BYUI Custom Pages"

Url="_custom/Library"

.... >


This will create the directory structure and a Document Library of the
specified name.

(here is a list of TemplateTypes for reference. It was harder for me to
find than I thought it would be:

msdn2.microsoft.com/en-us/library/ms462947.aspx )



Even with the library in place  if you change the file provisioning back
to Ghostable, ListInstance will create the directory structure, Module
will provision the file. The list will appear but the file will not show
up in the list (as you stated before). Either SharePoint Designer or
Open in Windows explorer will expose the provisioned file.

My feature.xml:

<ElementManifest Location="ListInstances.xml" />

<ElementManifest Location="ProvisionedFiles.xml" />

I know in the development course you showed us how to copy  a site
definition and modify that. Perhaps I'm going the long way around by
building it from the ground up but I'm gaining more confidence that you
can build a feature of any sized piece, as small as a column or as big
as a site  template, and any point inbetween.

 
Didn't find what you were looking for? Find more on create a sub folder "Resource" Or get search suggestion and latest updates.




Tagged: