Skip to main content
added 6 characters in body
Source Link
Robert Lindgren
  • 24.5k
  • 12
  • 53
  • 79

Could you tell a bit more on what part of the object model you are using?

If you are coding navigation api, theres other better approaches with the whole sitemap provider framework (like PortalSiteMapProviderPortalSiteMapProvider).

If you just want the current information in general, you can always use SPContext.CurrentSPContext.Current to get hold of data like current web, site, list, listitem etc.

For example current user: SPContext.Current.Web.CurrentUserSPContext.Current.Web.CurrentUser will return an SPUserSPUser object for current user.

To get current URL using SPContext.CurrentSPContext.Current use

  • SPContext.Current.Web.UrlSPContext.Current.Web.Url for absolute url
  • SPContext.Current.ServerRelativeUrlSPContext.Current.ServerRelativeUrl for the relative position of web on site

Could you tell a bit more on what part of the object model you are using?

If you are coding navigation api, theres other better approaches with the whole sitemap provider framework (like PortalSiteMapProvider).

If you just want the current information in general, you can always use SPContext.Current to get hold of data like current web, site, list, listitem etc.

For example current user: SPContext.Current.Web.CurrentUser will return an SPUser object for current user.

To get current URL using SPContext.Current use

  • SPContext.Current.Web.Url for absolute url
  • SPContext.Current.ServerRelativeUrl for the relative position of web on site

Could you tell a bit more on what part of the object model you are using?

If you are coding navigation api, theres other better approaches with the whole sitemap provider framework (like PortalSiteMapProvider).

If you just want the current information in general, you can always use SPContext.Current to get hold of data like current web, site, list, listitem etc.

For example current user: SPContext.Current.Web.CurrentUser will return an SPUser object for current user.

To get current URL using SPContext.Current use

  • SPContext.Current.Web.Url for absolute url
  • SPContext.Current.ServerRelativeUrl for the relative position of web on site
added 4 characters in body; deleted 33 characters in body
Source Link
Alex Angas
  • 6k
  • 9
  • 50
  • 89

couldCould you tell a bit more on what part of the object model you are using?

If you are coding navigation api, theres other better approaches with the whole sitemap provider framework (like PortalSiteMapProvider).

If you just want the current information in general, you can always use SPContext.Current to get hold of data like current web, site, list, listitem etc.

For example current user: SPContext.Current.Web.CurrentUser will return an SPUser object for current user.

To get current URL using SPContext.Current use

SPContext.Current.Web.Url for absolute url SPContext.Current.ServerRelativeUrl for the relative position of web on site

hth Anders Rask

  • SPContext.Current.Web.Url for absolute url
  • SPContext.Current.ServerRelativeUrl for the relative position of web on site

could you tell a bit more on what part of the object model you are using?

If you are coding navigation api, theres other better approaches with the whole sitemap provider framework (like PortalSiteMapProvider).

If you just want the current information in general, you can always use SPContext.Current to get hold of data like current web, site, list, listitem etc.

For example current user: SPContext.Current.Web.CurrentUser will return an SPUser object for current user.

To get current URL using SPContext.Current use

SPContext.Current.Web.Url for absolute url SPContext.Current.ServerRelativeUrl for the relative position of web on site

hth Anders Rask

Could you tell a bit more on what part of the object model you are using?

If you are coding navigation api, theres other better approaches with the whole sitemap provider framework (like PortalSiteMapProvider).

If you just want the current information in general, you can always use SPContext.Current to get hold of data like current web, site, list, listitem etc.

For example current user: SPContext.Current.Web.CurrentUser will return an SPUser object for current user.

To get current URL using SPContext.Current use

  • SPContext.Current.Web.Url for absolute url
  • SPContext.Current.ServerRelativeUrl for the relative position of web on site
Source Link
Anders Rask
  • 17.9k
  • 3
  • 39
  • 71

could you tell a bit more on what part of the object model you are using?

If you are coding navigation api, theres other better approaches with the whole sitemap provider framework (like PortalSiteMapProvider).

If you just want the current information in general, you can always use SPContext.Current to get hold of data like current web, site, list, listitem etc.

For example current user: SPContext.Current.Web.CurrentUser will return an SPUser object for current user.

To get current URL using SPContext.Current use

SPContext.Current.Web.Url for absolute url SPContext.Current.ServerRelativeUrl for the relative position of web on site

hth Anders Rask