# How to get an Organization ID from an Organization Name

The code below returns the Organization ID given an Organization Name.

{% code overflow="wrap" %}

```csharp
private long GetOrganizationID (string organizationName)
{
 long orgID = -1;
 string dataSet = string.Empty;
 string response = string.Empty;

 string filter = String.Format("OrganizationName='{0}'", organizationName);

 // Assuming lv is an instance of the QLM LicenseValidator class
 lv.QlmLicenseObject.GetOrganizations(string.Empty, filter, ref dataSet, out response);

 DataSet ds = new DataSet("NewDataSet");
 XmlReader reader = new XmlTextReader(dataSet, XmlNodeType.Document, null);

 if (!String.IsNullOrEmpty(dataSet))
 {
     ds.ReadXml(reader);

     if (ds.Tables[0].Rows.Count > 0)
     {
         DataRowCollection drc = ds.Tables[0].Rows;

         if (drc != null)
         {
            foreach (DataRow dr in drc)
            {
                 orgID = (long) dr["OrganizationID"];
                 Console.WriteLine(orgID.ToString());
                 break;
             }
          }
       }
  }

 return orgID;
}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.soraco.co/docs/faq/how-to-get-an-organization-id-from-an-organization-name.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
