Skip to Content
author's profile photo Former Member
Former Member

Get ABSOLUTE path to file?

Hi there,

Forgive the "stupid question" (I actually do BSP Portal development work mainly 😉) but how can I read a properties file or resource (image etc) from the .NET Portal environment?

I mean if I wanted to read properties in Java I would do something like:

IPortalComponentProfile profile = request.getComponentContext.getProfile();

response.write (profile.getProperty("myProperty"));

What do I do in .NET?

In my particlar instance I would like to create a copy of an "Excel Template" that I will deploy withe the .NET PAR I have code like the following:

Dim filePath As String = MapResourcePath("Web Resources/template/Template.xls")

This returns something like:


How can I get the ABSOLUTE path to this file?

Also how can I attach a properties file to the .NET Portal application and easily read them in?

Thanks alot for the help, much appreciated!



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Oct 16, 2005 at 10:05 AM

    Hi Lynton,

    <b>1.</b> You need to use MapPath function (of portal component object).

    <b>2.</b> In order to Read property you just need to use Profile object that related to the portal component class.

    <b>a.</b>The following example displays all the iView properties

    Sub DisplayAllProperties() Dim prop As SAP.Portal.Web.Components.Property For Each prop In Profile.Properties Write(prop.Name + " , " + prop.Value) Write("<br>") Next propEnd Sub

    <b>b.</b>custom property -

    <i><PortalComponentClassProperty("GlobalWeatherTitle", "Global Weather service description", _

    UserPersonalization:=PersonalizationType.NoDialog, _

    AdminPersonalization:=PersonalizationType.Dialog, _

    PlainDescription:="PortalComponent Title", _

    LongDescription:="PortalComponent Title", _

    PropertyType:=PropertyValueType.String, _

    Category:="GlobalWeather")> _</i>Public Class WeatherPortalComponent

    Inherits SAP.Portal.Web.UI.PortalComponent


    End Class




    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Lynton,

      1.If you want to change properties from the code you need to use the Profile object -

      this.Profile.Properties["MyProperty"] = "my new value";

      you can't add new properties without to change code and recreate the PAR file.

      2.Try this:

      //Get the full absulute path to myfile.txt file (placed at MyFiles directory).
      Label1.Text =  this.MapPath("MyFiles\myfile.txt");



Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.