• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to know a SubLabel belong to its corresponding SuperLabel?

 
Ranch Hand
Posts: 598
3
jQuery Google App Engine Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Language- C#
Database- Sqlserver.

I am using Gmail Api to extract labels from Gmail mailbox so that I can create such labels in outlook programmatically. I am adding these labels in the database before creating them in Outlook. The gmail mailbox has nested custom labels like this.



As you can see these labels are separated by "/" and Label_# is system generated IDs. MyCustomLabel2 is the subLabel of MyCustomLabel, MyCustomLabel3 is the sublabel of MyCustomLabel2 and MyCustomLabel4 is the sublabel of MyCustomlabel3 and so on. The names of the labels could be anything.

Before I create new custom Labels on outlook, I would like to know I am creating the right custom sub Label under its main custom label. I tried playing with string functions in c# without any luck.

My problem is not related to Gmail Api or outlook Api. It's completely related to string manipulation. A Java programmer can also help me as conversion from Java to c# code won't be hard.
 
Bobby Sharma
Ranch Hand
Posts: 598
3
jQuery Google App Engine Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Mod : please forward this topic to "Java in General" forum as well so that I can get replies from Java programmers. C# and Java are not that different when it comes to string manipulation.

best regards,
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've done that. But could I suggest you explain your problem a bit more?

I already looked at the post and decided not to answer. First of all I couldn't understand what your requirements were. And second of all I couldn't understand what you had tried, because you didn't say that either. So I couldn't find anything which was answerable at all.
 
Bobby Sharma
Ranch Hand
Posts: 598
3
jQuery Google App Engine Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Paul for forwarding the topic.

I am extracting Gmail Labels from using this code:



I am getting these outputs.




After manipulation using string functions I get the following output.



Gmail has Nested Labels in the following manner.



I am putting this data into my database table. How do I know a particular child Label belong to its main-label? for example, MyCustomLabel4 is a child Label and MyCustomLabel3 is its corresponding main label.
So I want to break them apart and save them separately so that I can do this using eWS api.



Label and folder are synonymous here.
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay... then is your question how to design your database table to preserve the relationship?
 
Bobby Sharma
Ranch Hand
Posts: 598
3
jQuery Google App Engine Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. The nested labels are tied to each other by "/". I need to split them and enter the data into the database table. Gmail Api doesn't have a way to tell us about the relationship between labels so I have to figure it out myself but I don't how to.

Label1/Label2......

The first part (before "/") is the parent label.

Currently my database has the following fields.
LabelID LabelName ChildLabelname


 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I understand it right, each "sub-label" is related to the "label" which is just before it, separated by a / character.

So you split the text on the / character and get an array of labels. So far so good. Next you have to go through the array and pick out the adjacent entries, like entry 0 and 1, entry 3 and 4, and like that.

But you don't do that. You go through the array in a way which prevents you from finding a label's parent.
 
Bobby Sharma
Ranch Hand
Posts: 598
3
jQuery Google App Engine Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes PAUL. So far, I have split two values only. it's only good for "Label/Sublabel" but is not working for "Label/Sublabel1/Sublabel2" or more.

Here is modified code:



 
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic