Showing posts with label Visual studio. Show all posts
Showing posts with label Visual studio. Show all posts

Wednesday, January 22, 2014

MSOCAF error- Remove inline code present in the aspx pages


Remove inline code present in the aspx pages. Inline code is not recommended within a site definition due to the issues involved with the code no longer rendering as soon as the page is customized. Inline code is supportable if included on a page in the _layouts directory. Inline code should not be allowed through the PageParserPath exclusion, except in extremely rare circumstances, because it can be modified without going through any review process. As a result, it represents a danger to the environment’s performance and security. Adding PageParserPath element to the web.config files is not allowed. Modifying these files may ‘break’ SharePoint in some way if you change the wrong part of the file
 
 
Found this error while running the MSOCAF on my project having aspx file been deployed to Layouts folder.
 
This error is mainly due to using the <script> tag in your ascx file as below to refere your "js" files in different location like site assests,layouts or any other location
 
 
<script src="myscripts.js"></script>
 
This tag throws the above error
 
This can be resolved by using the tags as mentioned below
 
<SharePoint:ScriptLink ID="ScriptLink1" Name="~sitecollection/siteassests/myscripts.js" runat="server" />
 
 

Monday, June 10, 2013

Multilingual markups in aspx pages

You can use the below tag to have a multilingual texts in aspx pages

Text="<%$Resources:testresourcefile, lbltest; %>"

Where testresourcefile is the default resource file name and lbltest is a key in all the resource files .

you got to have Resource files

  •  testresourcefile.resx
  • testresourcefile.en-US.resx
  • testresourcefile.de-DE.resx
  • etc
in Mappaed foledr called "RESOURCES" in your visual studio project.



for other multinguals

Infopath forms
Visual Webparts
Site columns,Content types and lists

Wednesday, June 5, 2013

Create Multilingual Sharepoint Site Columns,Content types and Lists from Visual studio programatically




·         Create resource file Eg: test.resx ; test.en-US.resx for English and  test.de-DE.resx for German
·         Add the key values Eg: Stringtest = Documan
·         Create site columns
·         Change the display name of site columns in element.xml as DisplayName="$Resources:Stringtest" Note:Stringtest should be in all the above resource files.
·         Now since your site columns are create in multilingual.
·         Create content type using these columns.
·         In the content types element.xml also do the same leave the FieldRef “id” “name” same but change the displayname as Eg ( DisplayName="$Resources:Stringtest ")
·         Now create the list using the content type .You the change the list definition and instance also in the same way as specified above
·         You can now deploy and check everything will be multilingual.


But Please note that these resource files should be added to the sharepoint MAPPED RESOURCE folder and also open you feature property and change the “default resource file “ to “test”
As our default resource file name in test