OneDrive/Extensions/ItemExtensionMethods.cs
/// <summary>
/// Returns the Path for an item.
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
Returns the Path for an item.
Returns the Path for an item .
public static string Path(this ODItem item, bool includeApiRoot = false)
        {
            if (null != item.ParentReference)
            {
                if (!includeApiRoot)
                {
                    string userPath = item.ParentReference.Path.Split(new char[] { ':' })[1];
                    if (null != userPath && !userPath.EndsWith("/"))
                        userPath = string.Concat(userPath, "/");
                    return "/" + userPath + item.Name;
                }
                var parentPath = item.ParentReference.Path;
                if (null != parentPath && !parentPath.EndsWith("/"))
                {
                    parentPath = string.Concat(parentPath, "/");
                }
                return parentPath + item.Name;
            }
            return null;
        }
public static string Path ( this ODItem item , bool includeApiRoot = false ) { if ( null != item . ParentReference ) { if ( ! includeApiRoot ) { string userPath = item . ParentReference . Path . Split ( new char [ ] { ' ' } ) [ 1 ] ; if ( null != userPath && ! userPath . EndsWith ( " " ) ) userPath = string . Concat ( userPath , " " ) ; return " " + userPath + item . Name ; } var parentPath = item . ParentReference . Path ; if ( null != parentPath && ! parentPath . EndsWith ( " " ) ) { parentPath = string . Concat ( parentPath , " " ) ; } return parentPath + item . Name ; } return null ; }
Returns the Path for an item.
Returns the Path for an item .
None
ODItem
this
includeApiRoot
bool
item
None