# Creating/Adding OPC Tags to a Managed Tag Provider via SDK

**URL:** <https://forum.inductiveautomation.com/t/creating-adding-opc-tags-to-a-managed-tag-provider-via-sdk/97672>\
**Category:** Module Development\
**Tags:** vision, ignition80\
**Created:** [October 23, 2024, 3:08pm UTC](https://forum.inductiveautomation.com/t/creating-adding-opc-tags-to-a-managed-tag-provider-via-sdk/97672 "2024-10-23T15:08:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Porter\_Ellis](https://avatars.discourse-cdn.com/v4/letter/p/ed8c4c/32.png) [@Porter\_Ellis](https://forum.inductiveautomation.com/u/Porter_Ellis)\
**Post date:** [October 23, 2024, 3:08pm UTC](https://forum.inductiveautomation.com/t/creating-adding-opc-tags-to-a-managed-tag-provider-via-sdk/97672/1 "2024-10-23T15:08:08Z")

</div>

# Creating/Adding OPC Tags to a Managed Tag Provider via SDK

Hello everyone,

I'm currently working on adding OPC tags to a managed tag provider using the Ignition SDK, and I've run into a few challenges. While I've successfully created OPC tags under the standard `default` tag provider, I’m having trouble doing the same for a managed tag provider.

Here is the code that works perfectly for the `default` tag provider:

```java
public void createOPCTag(String tagProviderName, String tagName, String opcServer, String opcItemPath) throws Exception {
    GatewayTagManager tagManager = context.getTagManager();
    TagProvider provider = tagManager.getTagProvider(tagProviderName);
    logger.info(provider.getName());
    TagPath method_tagName = TagPathParser.parse(tagName);
    TagConfiguration tagConfig = BasicTagConfiguration.createNew(method_tagName);
    tagConfig.setType(TagObjectType.AtomicTag);
    tagConfig.set(WellKnownTagProps.DataType, DataType.Float4);
    tagConfig.set(WellKnownTagProps.ValueSource, OpcTagTypeProperties.TAG_TYPE);
    tagConfig.set(OpcTagTypeProperties.OPCServer, opcServer);
    tagConfig.set(OpcTagTypeProperties.OPCItemPath, "ns=1;s=" + opcItemPath);
    List<TagConfiguration> newTagConfigs = new ArrayList<>();
    newTagConfigs.add(tagConfig);
    assert provider != null;
    CompletableFuture<List<QualityCode>> future =
            provider.saveTagConfigsAsync(newTagConfigs, CollisionPolicy.Overwrite);

    List<QualityCode> results = future.get(30, TimeUnit.SECONDS);

    for (int i = 0; i < results.size(); i++) {
        QualityCode result = results.get(i);
        if (result.isNotGood()) {
            throw new Exception(String.format("Add tag operation returned bad result for tag '%s'", newTagConfigs.get(i).getName()));
        }
    }
    newTagConfigs.clear();
}

```

### Issue

This code works as expected when targeting the `default` tag provider. However, when I attempt to create OPC tags under a managed tag provider, the tags don’t appear in the tag browser, and I don't receive any specific error messages that help identify the issue.

Has anyone successfully implemented OPC tags under a managed tag provider using the SDK? I'm looking for advice or best practices to ensure that OPC tags are correctly created and managed.

### Additional Resources

I’ve referred to the [Ignition SDK documentation on creating tags](https://www.sdk-docs.inductiveautomation.com/docs/appendix/tag-examples/create-tags), but I haven’t found specific details related to managed tag providers.

Any help or pointers would be greatly appreciated!

Thanks in advance!
