I'm working on an application that shows a listing of files and folders within a Sharepoint document library. The file/folder list is created based on the SPList's RootFolder.SubFolders and .Files collections.
Is there a way to filter out the "Forms" folder from the results, without hard-coding a check for a folder called forms?
You could check if the folder does not have an associated list item, i.e. if SPFolder.Item is null. Otherwise, hard-coding the name "Forms" should be ok as this does not change across different language versions of SharePoint.
Related
How to convert a queried list of file and folder paths a windows explorer display (which shows all path and date modified and can be right clicked and double clicked) on C# .net framework?
For example; imagine that there is a list of file and folder paths. Right now I think that those paths should be displayed on a "web browser" (in C# tool box)
For an example, this is already done with this software.
If I understand the question correctly, you have to declare a class which will have have properties to keep the value of FileName, FilePath, Size and DateModified. The collection of file will provide the file attributes which then can be iterated as a list and assigned those values to the properties as defined in that class.
In Outlook, I'm trying to add a shared public folder (provided by Exchange) to the list of favorite folders programmatically.
I've written an Outlook-AddIn for this, that uses the Microsoft.Office.Interop.Outlook library. In this library, there's only one way to add public folders to the favorite list:
Folder.AddToPFFavorites().
The problem: When calling this method, Outlook not only adds the folder itself to the favorites list, but also ALL subfolders. In our company, we have a huge tree of subfolders attached to some folders, so I get major performance problems (Outlook completely crashes when the folder to add has too many subfolders).
Do you know a way to programmatically add only the folder itself to the favorites, without any subfolders?
The Outlook object model doesn't provide anything for that. You have to use the AddToPFFavorites method of the Folder class.
I'm having some trouble trying to get a list of files stored within a folder that's stored within my Silverlight application client project. I'm trying to collect a list of file names of images to dynamically create URIs based on the files within that folder. All I need is a list of the file names.
I've tried:
App.GetResourceStream(new Uri(PathName));
and this works fine for getting files I know the name of. But I haven't found a way of returning a list of files yet.
My project is called TestWebsite
The the files would be stored within "TestWebsite\Images\ConceptArt\"
and all the files will be of the same image format e.i. '.jpg'
I have also tried this:
var result = Directory.EnumerateFiles(#"C:\Users\UserName\Pictures\ConceptArt\", "*.JPG");
but this needs access which seems more trouble than it's worth.
Your app is SL which is Browser based, so if you try to do things outside the SL sandbox, you are going to have to deal with Security. That is the nature of SL. If you could use local storage, then you wouldn't have the same issue. Or if your app is putting the files there, keep a list in local storage.
Greg
im working on a project where in i need to populate some files from the server and show them in a webrowser to the user. Where user would be allowed to do basic CRUD operation on the file
The problem is that i cannot assign the name of the file/folder as unique id which i need in case a user deletes/renames a file i should be able to identify the file later.
My question is that is there anything unique about any file/folder in NTFS that is unique about them and that can be used? and how that information can be accessed using .NET c#.
Came across the BY_HANDLE_FILE_INFORMATION structure but it probably needs me to pinvoke.
UPDATE 1 - tried looking at the feasibility to use nFileIndexHigh and nFileIndexLow but they would need me to do a pinvoke and also this method cannot be used with folders
one link when they mention folders Unique Folder Identifier tells me that it isnt possible.
Disregarding the fact that it seems that you don't want to P/Invoke a different approach could be to use the Windows Shell API. This API has the concept of a PIDL which identifies a folder (or "similar" item) in the shell namespace. A PIDL does not change even if the user renames the folder. The drawback is that the Shell API exposes what you see in Windows Explorer, e.g. Desktop is at the root of the hierarchy even though it physically is subfolder somewhere on a disk.
I think the FILE_INTERNAL_INFORMATION structure, used to query for the file system's 8-byte file reference number for a file, is what you need. The IndexNumber is a number that uniquely identifies a file. You should use P/invoke to query this information.
Is it possible to create a tree-structured Directory listing having checkbox, so that we can select that directory and get that value back..
This needs to be done in c# web application.
Here is your answer
http://forums.asp.net/p/1021570/1387710.aspx