Facebook events.create()

Jun 30, 2009 at 12:40 PM

Hi, i'm trying to create events on facebook:.
this is my code. I keep getting the error "Object reference not set to an instance of an object. "
Session["Facebook_userId"] = uid; var Events = new events(fAPI); var fbevent = new facebookevent(); fbevent.eid = 1; fbevent.name = "Testing Event"; fbevent.tagline = "testing teg line"; fbevent.nid = 1; fbevent.event_type = "party"; fbevent.event_subtype = "birthday party"; fbevent.start_date = DateTime.Now; fbevent.end_date = DateTime.Now.AddDays(7); fbevent.creator = uid; fbevent.location = "Brussels"; fbevent.pic = ""; fbevent.pic_big = ""; fbevent.pic_small = ""; location _loc = new location(); _loc.street = "mystreet"; _loc.city = "Brussels"; _loc.zip = "1000"; _loc.country = "Belgium"; fbevent.venue = _loc; Events.create(fbevent);

Does anyone know what's wrong with this?

Thx

Developer
Jul 28, 2009 at 3:47 PM

Not sure if this is it or not, but you shouldn't have to construct the Events API object like that. You should just be able to say: fAPI.events.create(fbevent);

Oct 15, 2009 at 8:29 PM

I'm having this same issue.  Has anyone been able to solve the problem?

Thanks,
Jason

Jan 22, 2010 at 9:57 AM
boenwas wrote:

Hi, i'm trying to create events on facebook:.
this is my code. I keep getting the error "Object reference not set to an instance of an object. "
Session["Facebook_userId"] = uid; var Events = new events(fAPI); var fbevent = new facebookevent(); fbevent.eid = 1; fbevent.name = "Testing Event"; fbevent.tagline = "testing teg line"; fbevent.nid = 1; fbevent.event_type = "party"; fbevent.event_subtype = "birthday party"; fbevent.start_date = DateTime.Now; fbevent.end_date = DateTime.Now.AddDays(7); fbevent.creator = uid; fbevent.location = "Brussels"; fbevent.pic = ""; fbevent.pic_big = ""; fbevent.pic_small = ""; location _loc = new location(); _loc.street = "mystreet"; _loc.city = "Brussels"; _loc.zip = "1000"; _loc.country = "Belgium"; fbevent.venue = _loc; Events.create(fbevent);

Does anyone know what's wrong with this?

Thx

 Hi boenwas ,

I am having the same issue "Object reference not set to an instance of an object when i am creating an event. How you got solution for this error. Please help me regarding this error.

Thanks,

Ibrahim.

 

Jan 29, 2010 at 3:15 AM

For starters you need to create the API like this:
Dim fbAPI As New Api(New ConnectSession(appKey, appSecret))

You also have to go through the login process to get the Session details from Facebook.  After you have session keys you can start calling the events methods like this.
fbAPI.Events.Create(eventDetails) 

The object reference error is because of how your declaring the API. 

Feb 1, 2010 at 7:41 AM
dknoodle wrote:

For starters you need to create the API like this:
Dim fbAPI As New Api(New ConnectSession(appKey, appSecret))

You also have to go through the login process to get the Session details from Facebook.  After you have session keys you can start calling the events methods like this.
fbAPI.Events.Create(eventDetails) 

The object reference error is because of how your declaring the API. 

 Hi dknoodle,

Now  i am able to create an event with an eventid. But the problem here is, it is not displaynig in my home page. If i test that eventid with API test console i am getting the details about that event but still i am not able to see the event in my home page. Please help me regarding this...

Thanks,

Ibrahim.

Feb 1, 2010 at 4:16 PM

From your Profile page (not your home page) click the + symbol on the tabs at the top next to Wall, Info, Photos, etc.  Click the Events app from the drop down list.  You should now be able to click the events tab and see the events you've created with the API.

You can also go directly to the event with a URL like this.  http://www.facebook.com/event.php?eid=[Event ID Here]&index=1

Still no way to Invite someone to the event you create unless you do it manually in Facebook.

Feb 3, 2010 at 4:30 AM
dknoodle wrote:

From your Profile page (not your home page) click the + symbol on the tabs at the top next to Wall, Info, Photos, etc.  Click the Events app from the drop down list.  You should now be able to click the events tab and see the events you've created with the API.

You can also go directly to the event with a URL like this.  http://www.facebook.com/event.php?eid=[Event ID Here]&index=1

Still no way to Invite someone to the event you create unless you do it manually in Facebook.

 Thanks a lot dknoodle. In this below url i have replaced eventid with my eid and its showing the event which is created http://www.facebook.com/event.php?eid=[Event ID Here]&index=1

But it is not showing in my events tab. Please help me regarding this problem..

Thanks.

Feb 3, 2010 at 4:13 PM

Unfortunately I'm not sure what to tell you on that one.  I've never had a problem with the event I create using the API not showing up in my Events tab.  Any chance you have more than one Facebook account?  Perhaps you created the event on one account and logged into another?

Feb 10, 2010 at 9:30 AM
Edited Feb 10, 2010 at 10:03 AM

regarding 

            fbevent.pic = "";
fbevent.pic_big = "";
fbevent.pic_small = "";

is inserting possible? By setting any image-URL?
Feb 17, 2010 at 5:20 AM
dknoodle wrote:

Unfortunately I'm not sure what to tell you on that one.  I've never had a problem with the event I create using the API not showing up in my Events tab.  Any chance you have more than one Facebook account?  Perhaps you created the event on one account and logged into another?

 Hi dknoodle,

I am able to create an event and it is displaying on my home page. How to check and assign Rsvp status to the created event. Please help me regarding this.

 Thanks for your kind help.

Thanks,

Ibrahim.

Feb 17, 2010 at 3:11 PM

Ibrahim,

I have an answer for you but your not going to like it.  

Before you can RSVP to an event you have to be Invited and/or invite someone.  However the FDT does not include Events.Invite.  The Events.Invite method was added to the Facebook API about the same time FDT was released so it didn't make it into the build.  I've added the necessary code to FDT on my end but it still does not work.   From what I can tell Facebook did not full implement it so that it will work with FDT.

More details can be found here.
http://facebooktoolkit.codeplex.com/Thread/View.aspx?ThreadId=72677

And here (bug I filed with Facebook).
http://bugs.developers.facebook.com/show_bug.cgi?id=8515 

Feb 22, 2010 at 5:46 AM
dknoodle wrote:

Ibrahim,

I have an answer for you but your not going to like it.  

Before you can RSVP to an event you have to be Invited and/or invite someone.  However the FDT does not include Events.Invite.  The Events.Invite method was added to the Facebook API about the same time FDT was released so it didn't make it into the build.  I've added the necessary code to FDT on my end but it still does not work.   From what I can tell Facebook did not full implement it so that it will work with FDT.

More details can be found here.
http://facebooktoolkit.codeplex.com/Thread/View.aspx?ThreadId=72677

And here (bug I filed with Facebook).
http://bugs.developers.facebook.com/show_bug.cgi?id=8515 

 Hi dknoodle,

Actullay i am writing FQL query for the rsvp status. In response i am getting only "attending" as my rsvp status as default.

Thanks,

Ibrahim