3
I have a reference conflict problem in the Google API.
In my API classes I always rename as follows: SiteTeste.APIS.Google.<Servico>
, where service is, Gmail, Translate, Drive or whatever.
Google Translate I name:
namespace SiteTeste.APIS.Google.Translate
The new API I’m using that is from GMAIL I name:
namespace SiteTeste.APIS.Google.Gmail
The problem is in the Gmail API where I need to import some namespaces:
using Google.Apis.Auth.OAuth2;
using Google.Apis.Gmail.v1;
using Google.Apis.Gmail.v1.Data;
using Google.Apis.Services;
using Google.Apis.Util.Store;
If I call the following line in my code, the compiler says:
Google.Apis.Gmail.v1.Data.Message message = new Google.Apis.Gmail.v1.Data.Message();
CS0234 The type name or namespace "Apis" does not exist in the "Siteteste.APIS.Google" namespace"
Which means he’s playing the Google.Apis.Gmail.v1.Data.Message
from "Siteteste.APIS.Google", I could resolve this by renaming the namespace of my APIS and removing Google, but I believe there is another way to resolve this conflict. If anyone can give me a north to solve this problem...
Try to put
global::Google.Apis.Gmail.v1.Data.Message message = new global::Google.Apis.Gmail.v1.Data.Message();
– Maniero
@Maniero Both yours and Renan’s solve my problem, thank you !
– Leonardo Bonetti