facebooktoolkit and C# photo upload problem - c#

I need help with integrating facebook into my desktop application. It's developed with C# - target framework is .NET framework 4.0.
I'm using http://facebooktoolkit.codeplex.com/
The problem is that I can't get the users albums although my app has permission for it, and for all to be more confusing I can get statuses, comments, friends, etc.
I have this in designer:
this.fbMyApp = new Facebook.Winforms.Components.FacebookService(this.components);
this.fbMyApp.ApplicationKey = "myappkey_goes_here";
this.fbMyApp.SessionKey = null;
this.fbMyApp.uid = ((long)(0));
And I've used this code(I've set all permissions for testing purposes):
fbMyApp.ConnectToFacebook(new List<Facebook.Schema.Enums.ExtendedPermissions>() {
Facebook.Schema.Enums.ExtendedPermissions.create_event,
Facebook.Schema.Enums.ExtendedPermissions.create_note,
Facebook.Schema.Enums.ExtendedPermissions.email,
Facebook.Schema.Enums.ExtendedPermissions.offline_access,
Facebook.Schema.Enums.ExtendedPermissions.photo_upload,
Facebook.Schema.Enums.ExtendedPermissions.publish_stream,
Facebook.Schema.Enums.ExtendedPermissions.read_mailbox,
Facebook.Schema.Enums.ExtendedPermissions.read_stream,
Facebook.Schema.Enums.ExtendedPermissions.rsvp_event,
Facebook.Schema.Enums.ExtendedPermissions.share_item,
Facebook.Schema.Enums.ExtendedPermissions.sms,
Facebook.Schema.Enums.ExtendedPermissions.status_update,
Facebook.Schema.Enums.ExtendedPermissions.video_upload
});
Now if I do this(after user has logged in):
MessageBox.Show("TOTAL statuses: " + fbMyApp.Status.Get().Count.ToString());
I will get the number of user statuses, and could read them. However if I do this:
MessageBox.Show("TOTAL albums: " + fbMyApp.Photos.GetAlbums().Count.ToString());
I get zero, although user has about 10 albums. I need this, cause this way I can access the album IDs and could be able to upload a photo to specific album. Any idea why this isn't working or does anybody have any better suggestion for some facebook toolkit for C#?

You need to request "user_photos" permissions from Facebook. I haven't used this toolkit as I prefer to make simple graph rest calls dynamically instead of having a huge library. I imagine you could download the source and recompile it, adding the missing permission. You could also switch to this library which is alot more up to date with current Facebook functionality.

Related

delete user from zk attendance device using c# api

I have set of ZK attendance device that using static IP address. I'm enrolling users to this machines using zkmkeeper.dll in C#. now i want to delete old users from these machines using system. I can't find the function to delete users, but there is function to disable. I want to delete that users permanently from devices.
I had a similar issue when deleting userInfo or enrolled data but i found a workaround
objCZKEM.DeleteEnrollData(machineId, userId, machineId, 12)
according to the documentation :
12 indicates deleting the user (including the fingerprints, card number and password).
#Yuuuucef, thank you for reference. According to documentation
5.2.4.3 DeleteEnrollData
VARIANT_BOOL DeleteEnrollData(LONG dwMachineNumber, LONG dwEnrollNumber,
LONG dwEMachineNumber, LONG dwBackupNumber)
The values of dwMachineNumber and dwEMachineNumber must be the same
After trying many ways I have finally found a way. clear all user data using axCZKEM1.ClearData(Convert.ToInt32(number), flag) and re enroll the data using Database.
The way I found works for me.
Use the SSR_deleteEnrollData function with only 3 parameters (while notice asks for 4 parameters)
SSR_deleteEnrolData(dwMachineNumber , dwEnrollNumber , dwBackupNumber)
Maybe depends of device version.

Couldn't get Apple Photos details - C# macOS Sierra 10.12 Xamarin Application

I'm developing an iMac desktop application which is able to upload normal photos as well as Photos library (Previously iPhotos library) to online services like Flickr,SmugMug. Before upgrading to Sierra i was able to get details of iPhotos and could upload too but after upgradation those files/directories doesn't exist.
Below is the block by which i was getting files:
string PhotosLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "Photos Library.photoslibrary/Database/apdb/Library.apdb");
But above is not working anymore in Sierra 10.12, if i go to finder itself to locate above mentioned path then i find 'Database' directory but no 'apdb' is there by which i can get Library.apdb
I have googled but no luck, can anybody please show me some pointers on how to get Photos Library files using C#.
Please tell me if i missed any information to share.
Thanks.
The Media Library Framework is the place to go if your situation permit.
NSDictionary<NSString, NSObject> options = new NSDictionary<NSString, NSObject>(
new[] { MLMediaLibrary.MediaLoadSourceTypesKey, MLMediaLibrary.MediaLoadIncludeSourcesKey },
new[] { new NSString(MLMediaSourceType.Image.ToString()), MLMediaSource.MediaSourcePhotosIdentifier }
);
var ml = new MLMediaLibrary(options);
ml.AddObserver("mediaSources", 0, (obj) => Console.WriteLine("Loaded"));
var src = ml.MediaSources; // returns null first time
In order to access MLMediaLibrary, your application has to be sandboxed and codesigned.
See also https://stackoverflow.com/a/29626032 to learn how to deal with entitlements.plist.

Is there anyway to fill in a form without user input with .net CF 3.5

I am working with windows ce for an application that needs to be authenticated before use. I don't want the end user to have to enter a username and password which is static everytime the device is turned on. Is there any way to do something like that? I was able to acheive it in a windows form application but i haven't seen anything on Stack or in the MSDN that will help me do that. My code for the forms app is below but it wont work in the Compact Framework.
//string doc = webBrowser1.DocumentText;
//HtmlElement userValue = doc.GetElementById("username");
//userValue.SetAttribute("value", "devacc");
//HtmlElement passValue = doc.GetElementById("password");
//passValue.SetAttribute("value", "zzq15354");
//HtmlElement subButton = doc.GetElementById("submit");
//subButton.InvokeMember("click");
I believe your going to need to verify user/device another way. I would probably save the devices MEID(Dec) # (which is unique) to your user data then allow access if signed in ON that specific hardware.. Here is a thread on how to find that number Find Serial Number

Showing different calendars in Windows Phone 7

I'm trying to get a complete list of all calendars. If I list
(new Appointments()).Accounts
I get only accounts like "Windows Live" or "Google". Actually I need a way to get the calendars and the appointments to that calendar inside the accounts. But it has to be on any account, not only the Live Account. Read only access is enough though. Is there any possibility?
If there is no chance, is this possible under WP8? Yes, I know, hardware capabilities were to high for this feature under WP7.8.
There is a method Appointments.SearchAsync which you should use. There is quite a nice example on MSDN:
Appointments appts = new Appointments();
appts.SearchCompleted += new EventHandler<AppointmentsSearchEventArgs>(Appointments_SearchCompleted);
DateTime start = DateTime.Now;
DateTime end = start.AddDays(7);
appts.SearchAsync(start, end, "Appointments Test #1");
Within callback function you'll have access to args.Results of type IEnumerable<Appointment>.
This is available on both WP7.1 and WP8.

getting access to outlook exchange global address book

i am building a csharp application and i would like a dropdown list of all users in my outlook global address book (the same one when i click on To: from outlook gui. is this possible to get this progrmaticall? what are the security requirements here?
Security ramifications, in addition to the Outlook dependency left me unable to use this approach, in the past. As a result, I ended up building this in the form of an LDAP query. Another plus is that, (in response to your other question) you will be able to extract contact information because this information is stored in the Active Directory.
DISCLAIMER: It has been almost five years since I have looked at this code, so I'm afraid I no longer fully understand the query. Hopefully it's enough to get you started, however.
DirectoryEntry adFolderObject = new DirectoryEntry();
DirectorySearcher adSearcher = new DirectorySearcher(adFolderObject);
adSearcher.SearchScope = SearchScope.Subtree;
adSearcher.Filter = "(& (mailnickname=*) (| (&(objectCategory=person)(objectClass=user)(!(homeMDB=*))(!(msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*))) ))";
foreach (SearchResult adObject in adSearcher.FindAll())
{
Console.WriteLine("CN={0}, Path={1}", adObject.Properties["CN"][0], adObject.Path);
}

Categories

Resources