Programmatically determine Parent Web’s Absolute URL from SharePoint Client Object Model ListItem

Ok, after a frustrating while of trying to figure out an easy way to get the FULL (Absolute) URL for a ListItem’s parent web using the SharePoint Client Object Model I discovered one thing for sure: There are an abundance of ways to easily find the ServerRelativeUrl for many objects in the Client OM, but that is not what I needed.

After talking to a co-worker, we finally found an easy way to get the parent web’s absolute URL when dealing with at Client OM ListItem.  The key is looking at the Context.

Assuming that you have a variable called “item” that represents an SP Client OM ListItem, you can get the full URL for the parent web like this:


string parentWebAbsUrl = item.ParentList.ParentWeb.Context.Url;

Sometimes it’s the simple things that get you.  Hope that helps you save some time!  Thanks for reading.

Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: