I'd like to check if a shortcut to a specific folder exists within my repository. I'd like to do this with code from the SDK if possible. I found the GetShortcuts() method which can be run on an entryinfo object, but since it's not TryGetShortcuts, I'm going to guess it doesn't return null if there are no shortcuts? It must return an empty readonlycollection, a class which I can't figure out how to check the size of.... I know the exact path for where the shortcut should be located as well, in case that helps.
Anybody have any suggestions? Can I do TryGetEntryInfo on a shortcut? Would that work?
Question
Question
Check if shortcut exists
asked on March 24, 2016
0
0
Answer
SELECTED ANSWER
replied on March 24, 2016
ReadOnlyCollection exposes a Count property, which you can compare with 0. In Visual Studio, selecting a type and pressing F12 will take you to its definition, where you can see what properties and functions it exposes, as well as what interfaces it implements.
0
0
replied on March 24, 2016
That did the trick! I should have read a little more into Count. I found it but instantly thought, "No, it can't be that simple."
//How to check if there are any shortcuts to an entry //based on entryinfo object named einfo //If no shortcut (if einfo.GetShortcuts().Count == 0){ //do this code } else{ //do this code }
0
0
Replies
You are not allowed to reply in this post.
You are not allowed to follow up in this post.