Giter Club home page Giter Club logo

Comments (11)

asrivas avatar asrivas commented on June 3, 2024

Hi zfima! Thanks for filing this issue. Could you provide more details? Are you using Visual Studio? Did you download a credentials.json file as part of your set up? A lot of our quickstarts have this as a step early

Another important step is to make sure if you are using VS is to make sure the file is in the Explorer:

  • Drag credentials.json (downloaded in Step 1) into your Visual Studio Solution Explorer.
  • Select credentials.json, and then go to the Properties window and set the Copy to Output Directory field to Copy always.

from dotnet-samples.

zzfima avatar zzfima commented on June 3, 2024

Hi
i use VS2017 professional
i did downloaded json file, of course
i did put allthis properties

json can be read with Assets.Open, but not with the FileStream

from dotnet-samples.

AlexOnn avatar AlexOnn commented on June 3, 2024

Hello, everyone, did you decide how to use FileStream in this case?

from dotnet-samples.

erickoledadevrel avatar erickoledadevrel commented on June 3, 2024

Closing due to inactivity. Let us know if the directions Anu provided no longer work.

from dotnet-samples.

gopalawasthi123 avatar gopalawasthi123 commented on June 3, 2024

System.IO.FileNotFoundException: Could not find file Exception credentials.json
Same Exception occures when i tried to integrate google sheets in xamarin forms. here is the sample code

` static string[] Scopes = { SheetsService.Scope.SpreadsheetsReadonly };
static string ApplicationName = "Google Sheets API .NET Quickstart";

    public MainPage()
    {
        InitializeComponent();
        GetExcelData();
    }

    private void GetExcelData()
    {
        UserCredential credential;
         string fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "My Project-dc555efb493f.json");
       // var x = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "My Project-dc555efb493f.json");
        using (var stream =
            new FileStream(fileName, FileMode.Open, FileAccess.Read))
        {
            // The file token.json stores the user's access and refresh tokens, and is created
            // automatically when the authorization flow completes for the first time.
            string credPath = "token.json";
            credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                GoogleClientSecrets.Load(stream).Secrets,
                Scopes,
                "user",
                CancellationToken.None,
                new FileDataStore(credPath, true)).Result;
            Console.WriteLine("Credential file saved to: " + credPath);
        }`

from dotnet-samples.

erickoledadevrel avatar erickoledadevrel commented on June 3, 2024

This sample was only designed to work as a Console application, and won't function on Xamarin.

from dotnet-samples.

gopalawasthi123 avatar gopalawasthi123 commented on June 3, 2024

Thanks @erickoledadevrel
In the Console Application it was working fine.
Can i somehow able to run in the xamarin forms project by shared project or something?

from dotnet-samples.

Emsysindiakt avatar Emsysindiakt commented on June 3, 2024

Hi, gopalwasthi123 did you find a solution for this issue.

from dotnet-samples.

gopalawasthi123 avatar gopalawasthi123 commented on June 3, 2024

@Emsysindiakt No we can't have option to implement it with xamarin. I have implemented it in console app

from dotnet-samples.

alexandresanlim avatar alexandresanlim commented on June 3, 2024

still no solution it?

from dotnet-samples.

KUBIXQAZ avatar KUBIXQAZ commented on June 3, 2024

solution:
copy everything from credential.json file and do it like that.

GoogleCredential credential;
credential = GoogleCredential.FromJson("text from file");

from dotnet-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.