Sky Software Homepage LogicNP Software Knowledge Base And FAQ

 
Contact Product Support    SearchSearch      Subscribe to the RSS feed for this forum

INFO: You get an 'Unknown Error' message when you try to save a file to your namespace extension on Vista or later

 
Subscribe to the RSS feed for this forum  Forum Index -> EZNamespaceExtensions.Net
View previous topic :: View next topic  
Author Message
Support



Joined: 18 Jul 2005
Posts: 731

Posted: Tue Oct 20, 2009 3:30 am    Post subject: INFO: You get an 'Unknown Error' message when you try to save a file to your namespace extension on Vista or later

The solution is to implement the NSEFolder.GetChildFromDisplayName method on the folder class(es) where you are trying to save as follows (taken from the FileSystemBrowser sample):
[C#]
Code:
// The GetChildFromDisplayName method is called to retrieve the item from
// its display name. If the e.AssumeChildExists parameter is true, the child with the
// specified display name should be assumed to in existence and an item representing
// that display name should be returned.
public override NSEItem GetChildFromDisplayName(GetChildFromDisplayNameEventArgs e)
{
  if(e.AssumeChildExists)
  {
    return new FileItem(this.fullPath, e.DisplayName);
  }
  else
  {
    // Return only if file truly exists
    if(File.Exists(Path.Combine(this.fullPath,e.DisplayName)))
    {
      return new FileItem(this.fullPath, e.DisplayName);
    }
    else if (Directory.Exists(Path.Combine(this.fullPath, e.DisplayName)))
    {
      return new FolderItem(this.fullPath, e.DisplayName);
    }
  }
  return null;
}


[VB.Net]

Code:
' The GetChildFromDisplayName method is called to retrieve the item from
' its display name. If the e.AssumeChildExists parameter is true, the child with the
' specified display name should be assumed to in existence and an item representing
' that display name should be returned.
Public Overrides Function GetChildFromDisplayName(ByVal e As GetChildFromDisplayNameEventArgs) As NSEItem
   
    If (e.AssumeChildExists) Then
        Return New FileItem(Me.fullPath, e.DisplayName)
    Else
        ' Return only if file/folder truly exists

        If (File.Exists(Path.Combine(Me.fullPath, e.DisplayName))) Then
            Return New FileItem(Me.fullPath, e.DisplayName)
        ElseIf (Directory.Exists(Path.Combine(Me.fullPath, e.DisplayName))) Then
            Return New FolderItem(Me.fullPath, e.DisplayName)
        End If
    End If

    Return Nothing
End Function
Back to top
Display posts from previous:   
Forum Index -> EZNamespaceExtensions.Net All times are GMT
Page 1 of 1

 
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group