{"action":"created","issue":{"url":"https://api.github.com/repos/OfficeDev/Office-365-SDK-for-Android/issues/75","labels_url":"https://api.github.com/repos/OfficeDev/Office-365-SDK-for-Android/issues/75/labels{/name}","comments_url":"https://api.github.com/repos/OfficeDev/Office-365-SDK-for-Android/issues/75/comments","events_url":"https://api.github.com/repos/OfficeDev/Office-365-SDK-for-Android/issues/75/events","html_url":"https://github.com/OfficeDev/Office-365-SDK-for-Android/issues/75","id":69628467,"number":75,"title":"Cannot attach Contact as ItemAttachment to an email","user":{"login":"JohnAustin-MSFT","id":8884923,"avatar_url":"https://avatars.githubusercontent.com/u/8884923?v=3","gravatar_id":"","url":"https://api.github.com/users/JohnAustin-MSFT","html_url":"https://github.com/JohnAustin-MSFT","followers_url":"https://api.github.com/users/JohnAustin-MSFT/followers","following_url":"https://api.github.com/users/JohnAustin-MSFT/following{/other_user}","gists_url":"https://api.github.com/users/JohnAustin-MSFT/gists{/gist_id}","starred_url":"https://api.github.com/users/JohnAustin-MSFT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohnAustin-MSFT/subscriptions","organizations_url":"https://api.github.com/users/JohnAustin-MSFT/orgs","repos_url":"https://api.github.com/users/JohnAustin-MSFT/repos","events_url":"https://api.github.com/users/JohnAustin-MSFT/events{/privacy}","received_events_url":"https://api.github.com/users/JohnAustin-MSFT/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-20T16:44:31Z","updated_at":"2015-04-21T17:38:06Z","closed_at":null,"body":"Folks,\r\nThe following code raises an internal server exception. The item object in the 2nd argument of my method actually cast from a valid Contact object.  The client is verified to be valid, the mail Id came from a new message I created and did not send yet.  The message sits in the user's draft mail message folder.\r\n\r\nI get the following internal server (501) error:\r\n\r\n\"Object reference not set to an instance of an object”\r\n\r\n    /**\r\n     * Gets a message out of the user's draft folder by id and adds a text file attachment\r\n     *\r\n     * @param mailId  The id of the draft email that will get the attachment\r\n     * @param itemToAttach The mail message to attach\r\n     * @return Boolean. The result of the operation. True if success\r\n     * @version 1.0\r\n     */\r\n    public Boolean addItemAttachment(\r\n            String mailId\r\n            , Item itemToAttach) throws ExecutionException, InterruptedException {\r\n        ItemAttachment itemAttachment = new ItemAttachment();\r\n        itemAttachment.setName(itemToAttach.getClass().getName());\r\n        itemAttachment.setItem(itemToAttach);\r\n        itemAttachment.setContentType(itemToAttach.getClass().getName());\r\n        itemAttachment.setIsInline(false);\r\n        itemAttachment.setId(itemToAttach.getId());\r\n        mMailClient\r\n                .getMe()\r\n                .getMessages()\r\n                .getById(mailId)\r\n                .getAttachments()\r\n                .add(itemAttachment)\r\n                .get();\r\n        return true;\r\n    }\r\n"},"comment":{"url":"https://api.github.com/repos/OfficeDev/Office-365-SDK-for-Android/issues/comments/94881939","html_url":"https://github.com/OfficeDev/Office-365-SDK-for-Android/issues/75#issuecomment-94881939","issue_url":"https://api.github.com/repos/OfficeDev/Office-365-SDK-for-Android/issues/75","id":94881939,"user":{"login":"JohnAustin-MSFT","id":8884923,"avatar_url":"https://avatars.githubusercontent.com/u/8884923?v=3","gravatar_id":"","url":"https://api.github.com/users/JohnAustin-MSFT","html_url":"https://github.com/JohnAustin-MSFT","followers_url":"https://api.github.com/users/JohnAustin-MSFT/followers","following_url":"https://api.github.com/users/JohnAustin-MSFT/following{/other_user}","gists_url":"https://api.github.com/users/JohnAustin-MSFT/gists{/gist_id}","starred_url":"https://api.github.com/users/JohnAustin-MSFT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohnAustin-MSFT/subscriptions","organizations_url":"https://api.github.com/users/JohnAustin-MSFT/orgs","repos_url":"https://api.github.com/users/JohnAustin-MSFT/repos","events_url":"https://api.github.com/users/JohnAustin-MSFT/events{/privacy}","received_events_url":"https://api.github.com/users/JohnAustin-MSFT/received_events","type":"User","site_admin":false},"created_at":"2015-04-21T17:38:06Z","updated_at":"2015-04-21T17:38:06Z","body":"Hi Marcos,\n\nI've tried the request using the Charles Proxy tool. I get the same error that I got in the response to the call using the client library.\n\nRequest\nThe following is the request JSON payload when a contact is attached:\n\n{\n\"Item\": {\n\"BusinessAddress\": {\n\"@odata.type\": \"#Microsoft.OutlookServices.PhysicalAddress\"\n},\n\"BusinessPhones\": [null, null],\n\"DisplayName\": \"New Contact  created on 2015-23-03 at 11:46\",\n\"EmailAddresses\": [{\n\"Address\": \"AlexD@patsoldemo4.onmicrosoft.com\",\n\"Name\": \"Alex Darrow\",\n\"@odata.type\": \"#Microsoft.OutlookServices.EmailAddress\"\n},\nnull, null],\n\"FileAs\": \"\",\n\"GivenName\": \"New Contact\",\n\"HomeAddress\": {\n\"@odata.type\": \"#Microsoft.OutlookServices.PhysicalAddress\"\n},\n\"HomePhones\": [null, null],\n\"ImAddresses\": [null, null, null],\n\"MobilePhone1\": \"5554251212\",\n\"OtherAddress\": {\n\"@odata.type\": \"#Microsoft.OutlookServices.PhysicalAddress\"\n},\n\"ParentFolderId\": \"AAMkADE5NTIzMjhjLWFkYjEtNDdjYS04NDBmLWMzYjNkZDM2ZDAzMAAuAAAAAACYmH-NJgoiR5Hddx6ToBrSAQA7Z34e4-q-Ta7-0CC9gFcSAAAAAAEOAAA=\",\n\"Surname\": \" created on 2015-23-03 at 11:46\",\n\"Categories\": [],\n\"ChangeKey\": \"EQAAABYAAAA7Z34e4/q/Ta7/0CC9gFcSAAAKOuzn\",\n\"DateTimeCreated\": \"2015-03-23T18:45:03.0000000Z\",\n\"DateTimeLastModified\": \"2015-03-25T21:48:59.0000000Z\",\n\"Id\": \"AAMkADE5NTIzMjhjLWFkYjEtNDdjYS04NDBmLWMzYjNkZDM2ZDAzMABGAAAAAACYmH-NJgoiR5Hddx6ToBrSBwA7Z34e4-q-Ta7-0CC9gFcSAAAAAAEOAAA7Z34e4-q-Ta7-0CC9gFcSAAAH3Go5AAA=\",\n\"@odata.type\": \"#Microsoft.OutlookServices.Contact\"\n},\n\"ContentType\": \"com.microsoft.outlookservices.Contact\",\n\"IsInline\": false,\n\"Name\": \"com.microsoft.outlookservices.Contact\",\n\"Id\": \"AAMkADE5NTIzMjhjLWFkYjEtNDdjYS04NDBmLWMzYjNkZDM2ZDAzMABGAAAAAACYmH-NJgoiR5Hddx6ToBrSBwA7Z34e4-q-Ta7-0CC9gFcSAAAAAAEOAAA7Z34e4-q-Ta7-0CC9gFcSAAAH3Go5AAA=\",\n\"@odata.type\": \"#Microsoft.OutlookServices.ItemAttachment\"\n}\n\n\nResponse\n{\n\"error\": {\n\"code\": \"ErrorInternalServerError\",\n\"message\": \"Object reference not set to an instance of an object.\"\n}\n}\n\nFrom: Marcos Torres <notifications@github.com<mailto:notifications@github.com>>\nReply-To: OfficeDev/Office-365-SDK-for-Android <reply@reply.github.com<mailto:reply@reply.github.com>>\nDate: Monday, April 20, 2015 at 9:46 AM\nTo: OfficeDev/Office-365-SDK-for-Android <Office-365-SDK-for-Android@noreply.github.com<mailto:Office-365-SDK-for-Android@noreply.github.com>>\nCc: John Austin <johnau@microsoft.com<mailto:johnau@microsoft.com>>\nSubject: Re: [Office-365-SDK-for-Android] Cannot attach Contact as ItemAttachment to an email (#75)\n\n\nHi John.\nIf you try to do the same thing using a REST client like Fiddler, can you reproduce the behavior?\n\n-\nReply to this email directly or view it on GitHub<https://github.com/OfficeDev/Office-365-SDK-for-Android/issues/75#issuecomment-94505256>.\n"}}