Hello,
I would like to get contents of MFFolderContentItemTypePropertyFolder of a view as shown in the attached image and also how do I get the ID 15. Thank you
Hello,
I would like to get contents of MFFolderContentItemTypePropertyFolder of a view as shown in the attached image and also how do I get the ID 15. Thank you
This is a grouping. The grouping exists within a view. You get the contents of the view (e.g. via GetFolderContents) which will return you potentially different types of things, including the groupings. For the groupings they have details on the TypedValue that represents the actual group. In the case of the screenshot you should have something representing the Agenda grouping, and a TypedValue which has the display name of "Agenda" and a lookup value of 15.
So how do i get the contents in the Agenda?
I don't understand the question, sorry. You asked how to loop through the levels. You showed a loop going over the levels.
What are you trying to achieve?
But I don't know the interface to use for looping for example in getting the contens we use FolderContentItem in a loop. e.g.
foreach (FolderContentItem item in mfilesSearchResult)
{
}
. so, what do we use in Levels?
Show me a picture of the structure you have and what you want to output.
Broadly I think you need to convert the folder content item that represents the grouping across to a folder def, and use that to request the next set of data. But I'm not sure on the specifics until I can picture the output you're after.
I want to know how to pull or extract the property used in grouping the way it is written there as shown such as the
Year(Created) and Month(Created)
In the other thread we talked about getting the view via the API. The levels on the view is an ExpressionExs instances: M-Files API - Levels Property.
This is effectively a collection of ExpressionEx instances: M-Files API
The ExpressionEx contains an Expression: M-Files API - Expression Object
The Expression details the details about the grouping. You probably want to look at the Type, for example, to ensure that it's a property grouping: M-Files API - Type Property
For property groupings you need to look at the Expression's DataPropertyValuePropertyDef which contains the property that it's grouped by ("Created" in your screenshot above): M-Files API - DataPropertyValuePropertyDef Property. This is an ID which you would cross-reference with the property definitions in the vault (e.g. M-Files API - GetPropertyDefs Method).
Some groupings may also contain additional data, as well as the property. For example you can find out about the data function (year/month) from the DataPropertyValueDataFunction property: M-Files API - DataPropertyValueDataFunction Property
There's also lots of other data in the Expression which may be of interest including, for example, indirection levels.
If you need to get all this information programmatically then you'd look at all of the above and be able to get what you need. There is also a "GetExpressionAsText" method which may give you the simple string, if that's all you need: M-Files API - GetExpressionAsText Method
Also, this actually worked for level one now how do i navigate to level two
You add an additional value to the folder defs collection representing the second grouping level.
How? For example, this is the code for level one.
TypedValue typedValue = new TypedValue();
FolderDefs folderDefs = new FolderDefs();
#region setting the view
{
var folderDef = new FolderDef();
folderDef.SetView(201);
folderDefs.Add(-1, folderDef);
}
#endregion
#region setting the folder prop
{
typedValue.SetValue(MFDataType.MFDatatypeInteger, "2024");
var folderDefp = new FolderDef();
folderDefp.SetPropertyFolder(typedValue);
folderDefs.Add(-1, folderDefp);
}
#endregion
var mfilesSearchResult = vault.ViewOperations.GetFolderContents(folderDefs);
You would repeat the "setting the folder prop" region as many times as needed. You currently have one grouping level there, so you'd add a second if you needed a second grouping level, a third if you needed a third, etc.
Just a sample for example for the month of February or "02" for text type
on that code of mine
Just a sample for example for the month of February or "02" for text type
on that code of mine
If I try this I get an error message.
TypedValue typedValue = new TypedValue();
FolderDefs folderDefs = new FolderDefs();
#region setting the view
{
var folderDef = new FolderDef();
folderDef.SetView(201);
folderDefs.Add(-1, folderDef);
}
#endregion
#region setting the folder prop
{
typedValue.SetValue(MFDataType.MFDatatypeInteger, "2024");
var folderDefp = new FolderDef();
folderDefp.SetPropertyFolder(typedValue);
folderDefs.Add(-1, folderDefp);
}
#endregion
#region setting the second level folder prop
{
typedValue.SetValue(MFDataType.MFDatatypeText, "12");
var folderDefp = new FolderDef();
folderDefp.SetPropertyFolder(typedValue);
folderDefs.Add(-1, folderDefp);
}
#endregion
var mfilesSearchResult = vault.ViewOperations.GetFolderContents(folderDefs);
...what error message?
The parameter is incorrect.
CoFolderContentItem.cpp, 516, The parameter is incorrect. (0x80070057)
(M-Files 24.11.14245.5 2025-01-08T10:07:06.820Z)
<bin>
AgAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAANQAxADYAAAAwAAAAQwBvAEYAbwBsAGQA
ZQByAEMAbwBuAHQAZQBuAHQASQB0AGUAbQAuAGMAcABwAAAAVwAHgAACAAAAAAAAAAAAAQ==
</bin>
(0027)
Why are you passing the data type as text? Should it not be an integer?
it is a text even if I pass integer still the same error
if I change to integer wrong datatype
Going back to a post from a few months ago we talked about getting the view definition data via the API: Getting Items of MFFolderContentItemTypePropertyFolder - API - Forums - M-Files Community
What groupings does that return, and what are the data types?
the response is just like the first one except the datatype is changed to text
I have figured it out I was supposed to remember the levels
but still, I can't be able to access the objects now. if I add another grouping like date it works.
© 2024 M-Files, All Rights Reserved.